Rick_CBR929RR
Rick_CBR929RR

Reputation: 307

How to pass Section and Row specified tableview cell content through a segue?

I've often used prepareForSegue to pass stuff forward to the next view controller. No problem when my tableview doesn't use sections. But I've added sections to my latest project. Now I don't know how to use prepareForSegue because it doesn't receive the indexpath, which contains the section reference. What am I missing? Thanks for the help!

Upvotes: 2

Views: 151

Answers (1)

rdelmar
rdelmar

Reputation: 104082

In your prepareForSegue method, just use:

NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

and pass that along to the destinationViewController.

Upvotes: 3

Related Questions