Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView "selection" triggered segue

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?

Xcode Screen

like image 211
Shane Hsu Avatar asked Dec 21 '12 12:12

Shane Hsu


1 Answers

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).

like image 52
Levi Avatar answered Sep 28 '22 10:09

Levi