首页 > 解决方案 > 接收者没有标识符“goToDetail”的segue

问题描述

我已经仔细检查了我的标识符在情节提要中的拼写是否正确,并且转场指向正确的方向,但我一直收到此错误。有人可以看看我的代码,看看我是否遗漏了什么?

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let selectedData = tableData[indexPath.row]
        tableView.deselectRow(at: indexPath, animated: true)
        performSegue(withIdentifier: "goToDetail", sender: selectedData)
    }
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if let destination = segue.destination as? DetailViewController {
            destination.vocab.text = sender as? String
        }
    }

编辑: 在此处输入图像描述

标签: iosswift

解决方案


segue只有当你有一个 UINavigationController 来处理导航时才能使用。你对UINavigationController. UINavigationController应该在故事板的根部。

在此处输入图像描述


推荐阅读