2
votes

In my app delegate I create a UISplitViewController. I set the delegate to be the detailViewController.

When I run my app in portrait, I have the left top popover button showing that will slide out the split view master.

Then I have a button in my detail view that resets the splitviewcontroller array with a new detail view controller and sets the split view delegate to that controller.

The second detail view displays properly... but I lose my popover button on the second view controller.

Does anyone know how I can get that button to remain on all of my detail view controllers I may add?

Thanks!

1

1 Answers

2
votes

See http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=1546 for what I find to be a good approach.

It involves setting the SplitViewController delegate to be the master instead of the detail. The master keeps references to the popoverController and the button, and each time the delegate methods are called (hide and show master) it gets the current detail view and performs the necessary action (add in the button/remove button and popovercontroller).

The master defines a protocol for "SubstituableDetailView" which contains the two methods for showing/hiding the button.