Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Perform segue based on IndexPath on table cell view

I have a table view with 3 rows (option 1, option 2, option 3) but the detail view for every single one is different, I mean, I want to perform a different segue depending upon the selected row. I've added 3 detail views on the storyboard and I've connect every single table cell from the table view with its detail view so this way I can have 3 segues but performing the first one actually, it seems that the first segue is the default segue for the rest of the table cells. Any ideas will be welcome.

2 Answers

have you already tried creating an instance of NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

you also might have to use the prepareForSegue method with UITableViewCell and use that instance of NSIndex path that i showed you above.

imma see how you can do it though.

you also might have to use the prepareForSegue method with UITableViewCell and use that instance of NSIndex path that i showed you above. and rename each cell with the proper identifier.

imma see how you can do it though.

Thanks men, I will try and let you know. Thanks for your time.