第一次选择 TableView 行时,它没有响应

The first time a TableView row is selected, it does not respond

我用两个视图控制器编写了一个简单的应用程序:

这是最相关的代码,可以根据要求添加更多。这是TableViewController:

中的didSelectRowAt函数
    override func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {

        if let vc = storyboard?.instantiateViewController(withIdentifier: "Browser") as? ViewController {
            vc.approvedWebsites = websites
            vc.selectedWebsite = websites[indexPath.row]
            navigationController?.pushViewController(vc, animated: true)

        }

目前,当我 运行 程序和 select 任何行时,该行将保持突出显示并且不响应。我在该行中添加了一个打印功能(在 if let 上方),但它不会打印。

但是,我 select 的下一行将响应,但使用我之前 select 编辑的那一行的网站。我对此进行了大力测试,它总是会加载我之前 select 编辑的网站。当我退出 webView 屏幕时,它会重置所有内容,我可以在不重新加载应用程序的情况下重现相同的错误。

对正在发生的事情有什么想法吗?

想通了。确保您使用的是 DidSelectRowAt 而不是 DidDeselectRowAt。