iPad SplitViewController with menu in portrait mode like settings app

I would like obtain a SplitView on my iPad application with my left menu in a portrait orientation such as iPad settings. For now in portrait orientation I have a content view in full screen and I have a button at NavigationBar which includes a popover with my left menu.


Solution 1:

This is the magic you need:

This method is in UISplitViewControllerDelegate, available on iOS 5.0

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

Solution 2:

You should definitely have a look at Matt Gemmell's MGSplitViewController.

MGSplitViewController is an open source replacement for UISplitViewController, with various useful enhancements.

Solution 3:

Unfortunately, it's an undocumented method (i.e. private API).

[splitViewController setHidesMasterViewInPortrait:NO];

I think you need to create a custom view controller containing a table view (as the master controller) and another generic subview (as the detail controller) to simulate this.

Solution 4:

The easiest way to get the effect you want may be to just not use a UISplitView. Instead, just create a normal view, put a table view on its left side, your detail view on the right side, and then set the autosizing stuff appropriately so that everything looks right in both portrait and landscape.