简体   繁体   English

我试图在覆盖函子tableView(…didSelectRowAt…)中关闭tableViewController,但没有任何反应

[英]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 从我的头顶上,我可以在这里看到两个潜在的问题

  1. The tableView delegate is not set 未设置tableView委托
tableView.delegate = self
  1. The viewController was not presented rather pushed, of that is the case try 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.

相关问题 DidSelectRowAt ..什么都没有发生 - DidSelectRowAt .. nothing happens 我正在尝试在 TableViewController 中加载 collectionView 并将 collectionView 添加到 tableView 的子视图中 - I'm trying to load a collectionView in a TableViewController and adding the collectionView in the subView of tableView tableView(_ tableView:UITableView,didSelectRowAt indexPath:IndexPath)将UITapGestureRecognizer添加到自定义UITableViewCell时不起作用 - tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) Doesn't work when I add a UITapGestureRecognizer to my custom UITableViewCell 覆盖 func tableview 运行后 - Override func tableview runs after 尝试通过轻量级迁移来更新我的DBModel,但没有任何反应 - Trying to update my DBModel with lightweight migration but nothing happens 在GMSMapView上未调用tableView(_:didSelectRowAt :) - tableView(_:didSelectRowAt:) is not called on GMSMapView 如何在按钮动作内的TableViewController中重新加载tableview? - How can I reload tableview within my TableViewController within button action? 尝试搜寻时,什么也没发生 - When trying to segue, nothing happens 解除数据后如何从TableViewController传递数据? - How can I pass the data from a TableViewController when I dismiss it? 我如何关闭通过方法addsubview添加的tableviewController - How can I dismiss tableviewController that view added by method addsubview
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM