Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISplitViewController Cannot Change the Master View Controller?

I am trying to change the master view controller (that appears in the popover in portrait, and on the left side in landscape) in a UISplitViewController. I'd like to switch between the master view controller being one of two different UIViewControllers (depending on an action taken elsewhere in my application).

I am using the following:

mySplitViewController.viewControllers = [NSArray arrayWithObjects:newMasterController, detailController, nil];

This correctly changes the master viewcontroller as you would expect in landscape mode. However it does not seem to change the viewcontroller used for the popover in portrait mode.

I notice that the barbuttonitem to show this master view controller is just calling showMasterInPopover: on the splitviewcontroller, and so would expect it to work in portrait mode as well, but it does not.

In fact, I can set the master view controller, see the new viewController correctly in landscape mode, rotate back to portrait, and the viewcontroller used in the popover is still the old one.

Is this a bug?

like image 322
Nex Avatar asked May 04 '10 08:05

Nex


1 Answers

In case anyone is looking for a solution to this issue (or a word-around), I had a similar issue and worked it out here: Changing the master view in Split View does not update the popover in portrait

Basically, I used a navigation controller for the master view controller, and pushed/poped view controllers within that navigation controller, in order to change view controllers in the master view whilst still displaying the correct viewcontroller in portrait orientation, in the popup view.

like image 62
SMSidat Avatar answered Sep 30 '22 10:09

SMSidat