问题
I've got an app using the a split view controller and I'm setting the master and detail view controllers in the App delegate. However, depending on user interaction (them touching a UIButton), I am changing the master view, by accessing the viewcontrollers array of the split view controller.
The problem is, when I do this, and then change the orientation of the iPad to portrait, and access the master view via the popover, it is showing the previous master view, and not the new one I had set. This is confusing, since, in landscape orientation, the correct master view (the new one that has been set) is being shown. Not sure why the popover in portrait is not updating to the new master view set in the viewcontrollers property of the split view.
Would appreciate any ideas on how to rectify this. Thanks.
回答1:
I managed to solve the problem. Just for the record and in case anyone else may have this problem in the future - the solution I eventually found was to use a navigation controller for the master view controller, and then push/pop viewcontrollers as I needed.. and I no longer have issues with the popover in portrait orientation! Just be careful not to push the same controller twice, otherwise the app will crash - when done with the controller, pop it.
来源:https://stackoverflow.com/questions/8610132/changing-the-master-view-in-split-view-does-not-update-the-popover-in-portrait