Joris Dijkstra
Joris Dijkstra

Reputation: 132

How to add multiple Detail View Controllers in Master-Detail application

I am trying to build an iPad Master-Detail app. The master View is just a TableViewController. I want to change the complete Detail view for every different cell the user taps in the Master View. One of the Detail view controllers has to allow the user to type data, the other to view something, etc. So How can I add more DetailViewControllers to a Master-Detail app?

Upvotes: 4

Views: 5281

Answers (2)

rdelmar
rdelmar

Reputation: 104082

You should use replace segues for this purpose. Connect as many view controllers as you want directly from the master controller (not the cells) with replace segues, and give them all identifiers. In didSelectRowAtIndexPath:, implement whatever logic you need to relate the index path to which controller you want to segue to, and then call performSegueWithIdentifier:sender: to initiate the segue. If you need to pass any data on to the next controller, you can do that in prepareForSegue.

Upvotes: 6

LVSS
LVSS

Reputation: 1

"MultipleDetailViews" sample app from apple might help. Here is the link http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html. Also I believe there are other similar questions in stackoverflow.

Upvotes: -3

Related Questions