Storyboard segue gets called before UITableView's didSelectRow

岁酱吖の 提交于 2019-12-05 09:37:52

Don't create the Segue from the Cell to the new VC, instead set the Segue from the old VC to the new VC and give the segue an identifier.

Then within

didSelectRowAtIndexPath you can call

[self performSegueWithIdentifier:@"Segue" sender:self]

Rawkode's answer is one good solution - an alternative is that, in prepareForSegue:, you can access the selected row of the table view (the sender argument will be the table view cell, you can then do [self.tableView indexPathForCell:(UITableViewCell*)sender] to get the index path) and set up whatever you need at that point.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!