UITableView “selection” triggered segue

只谈情不闲聊 提交于 2019-12-04 19:25:16

问题


I am using Storyboard and UITableView without UINavigationController.

When tapping on any cell, it should bring user to a detail page. I can of course implement didSelectRowAtIndexPath:

But I wished to try something fairly different. I want to do it with a storyboard segue. I use prototype cell, and I can simply config a triggered segue on the cell. I can implement prepareForSegue:, but here's the problem, how can I know what cell has been selected?


回答1:


The prepareForSegue:sender: method's sender parameter is the cell you are looking for. You can get it's index path by [self.tableView indexPathForCell:sender] (you may need a cast).




回答2:


to get a clear view about how to use storyboard please check the following tutorial, how to use Storyboard

make sure that you read the second part too....this will give you a clear idea how to use, and the solution for your question also is there.



来源:https://stackoverflow.com/questions/13989826/uitableview-selection-triggered-segue

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