Reputation: 45
I am currently implementing a simple fitness app.
I have each exercises for each tableviewcell row and when i click each tableviewcell, I want to segue it to tutorial screen where it shows short clip of video.
My question is;
If I have 100 different exercises, do i need to created 100 different segue for each exercises?
and how do I make different tableviewcells to segue into same view?
Upvotes: 0
Views: 71
Reputation: 131398
You asked "If I have 100 different exercises, do i need to created 100 different segues..."
In a word, no.
You could create a single view controller to view controller segue and give it an identifier.
Implement the tableView:didSelectRowAtIndexPath:
method. In that method, save the selected indexPath to an instance variable and call performSegueWithIdentifier to invoke your segue.
In your prepareForSegue method, take the selected cell's indexPath and use it to look up the data for that cell. Cast the segue's destination view controller to the correct class, and then set a property you've defined in the destination view controller to the data you want to display for the selected cell (information about the selected exercise, in this case.)
Upvotes: 2