3
votes

I'm developing an iOS8 iPad application which uses a UISplitViewController as it's root view controller similar to the master-detail template.

My app requires me to display both master and detail views at all times, side by side in both portrait and landscape. I have this set up and everything is working well with one exception. I need to be able to expand the master view full screen, thus hiding the detail view. I'm well aware that the opposite is easily achievable (expanding detail to full screen hiding master). I am essentially looking for the same functionality but in reverse.

This is the code that provides the expand/contract functionality to the detail view:

self.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem;
self.navigationItem.leftItemsSupplementBackButton = YES;

Is it possible to achieve this effect on the MASTER view controller? I need this effect because my MASTER view controller is my dominant view controller with lots of information displayed in table format whereas my detail view controller does not need much screen estate.

I have tried to simply just set the preferredPrimaryColumnWidthFraction = 1 to simply cover the detail view but this seems more like a hack and does not provide the default animation of the expanding of the detail view.

No I cannot have my table set as a detail (and appearing on right).

No I cannot have my detail view set as a master (and appearing on the left).

No I do not want to use an open source library to achieve this (if possible)

1

1 Answers

0
votes

This doesn't seem to be a default transition.

You can try and start with the recommendation of "Collapsing and Expanding the Split View Interface":

When transitioning to a collapsed interface, the split view controller works with its delegate to manage the transition. At the end of a collapse transition, the split view controller normally shows only the content from its primary view controller. You can change this behavior by implementing the primaryViewControllerForCollapsingSplitViewController: method in your split view controller delegate. You might use that method to specify the secondary view controller or an entirely different view controller—perhaps one better suited for display in a horizontally compact environment. If you want to perform any additional adjustments of the view controllers and view hierarchy, you can also implement the splitViewController:collapseSecondaryViewController:ontoPrimaryViewController: method in your delegate.

This way, you may collapse but show the master view controller in full instead by hookin in to primaryViewControllerForCollapsingSplitViewController:.

This will probably look weird, so you're better off presenting the master view controller modally with a custom resizing animation. In the worst case, you can add another UIWindow on top of the existing one to detach the master view controller. In the best case, you fiddle with the existing view controller hierarchy and detach the master from there. I can imagine this will cause a lot of trouble with changing orientation, though.