0

Two similar questions have been asked here before:

Split view in portrait mode!

Forcing an iPad app to show splitView even in Portrait orientation(Like the Settings iPad app)

Both questions were largely answered with "not officially supported - roll your own or use a third-party custom controller"

However, I'm digging through WWDC 2011 Apple Developer videos (Session 102, specifically), and about 30 minutes in the presenter declares that this feature now is supported in iOS 5. The problem is that I don't know how to implement it. Here's the code from the slide:

@protocol UISplitViewControllerDelegate
...
// Returns YES if a view controller should be hidden by
// the split view controller in a given orientation.
// (This method is only called on the leftmost view controller
// and only discriminates portrait from landscape.)
- (BOOL)splitViewController: (UISplitViewController*)svc
    shouldHideViewController:(UIViewController *)vc
        inOrientation:(UIInterfaceOrientation)orientation;
@end

So - what do I do with this?

Community
  • 1
  • 1
Brian Bauman
  • 668
  • 5
  • 22

1 Answers1

3

I read through a bunch of stuff and actually found the way to do it correctly now. Go to your detailViewController. Your detailViewController should have UISplitViewControllerDelegate. And simply just drop this code in:

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation{
    return NO;
}

This will make all the view stay in place. Let me know, if it works for you.

Byte
  • 2,920
  • 3
  • 33
  • 55