I am trying to make it where when a user clicks on a table view cell in my table view it takes them to a new view controller. More specifically, when a user clicks on a persons username it should take them to that users profile. the username being the table view cell and the profile being the new view controller. I thought the way to do this was to use the ".presentViewController(vc, animated: true, completion: nil) however when i do this it says "myCell does not have a member named .presentViewController"![Below is a screenshot of the issue](https://i.stack.imgur.com/mZIUW.png)
如果有人能帮助我解决这个问题,我将不胜感激
The presentViewController:animated:completion
是一个实例方法UIViewController
not UIView
或的子类。你可以试试这个:
self.window?.rootViewController.presentViewController(specificViewController, animated: true, completion: nil)
但是,我建议您应该使用presentViewController:animated:completion:
方法来自UIViewController
。之间可以实现回调机制UIViewController
和cell
.
Like so:在 UI 表视图单元格内获取按钮单击 https://stackoverflow.com/questions/20655060/get-button-click-inside-ui-table-view-cell
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)