How to show the Master View button in a UISplitViewController app

I was tinkering with an iPad version of one of my apps, when I noticed that the nav bar button that hides and shows the Master View Controller in portrait mode was no longer displayed. You know, the one that reads “Master” by default.

This is a problem if my app starts in portrait mode, because there’s no way to bring this button back. The Split View Controller handles that button in its willHideViewController delegate method – which was seemingly never called upon startup (anymore).

I can’t call that method manually on startup because I don’t have the parameters that call this method – but I did find a solution that forces the Split View to call this method:

// bring back the Master button in portrait
[self.splitViewController.view setNeedsLayout];

Calling this somewhere in viewDidLoad doesn’t hurt your app – but it avoids having to solve The Case of the Disappearing Split View Button.

Leave a Reply