[英]I amt trying to dismiss my tableViewController in override func tableView(…didSelectRowAt…), but nothing happens
I want to return to my previous viewController, so I used the dismiss method, but when I select a cell nothing happens. 我想返回到以前的viewController,所以我使用了dismiss方法,但是当我选择一个单元格时什么也没有发生。 This is the code that I have right now. 这是我现在拥有的代码。
override func tableView(_ tableView: UITableView, didSelectRowAtindexPath: IndexPath) {
delegate?.dataReceived(data: universityArray[indexPath.row].name)
dismiss(animated: true, completion: nil)
}
Form the top of my head, i can see two potential problems here 从我的头顶上,我可以在这里看到两个潜在的问题
tableView
delegate is not set 未设置tableView
委托 tableView.delegate = self
popViewController
instead of dismiss
viewController不是呈现而是被推送,在这种情况下,请尝试popViewController
而不是将其dismiss
self.navigationController?.popViewController(animated: true)
Hope the problem was one of the above. 希望问题是上述问题之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.