Handle Displaying Documents in UISplitViewController

A split view controller often seems like the ideal solution to display a list of documents (for example using the PSPDFDocumentPickerController) in one view controller and displaying a PSPDFViewController in another view controller. But beware, there's a lot of things and magic going on behind the scenes of UISplitViewController to mess with your expected behavior. To get more insight on how the split view controller works, have a look at the WWDC video on View Controller Advancements in iOS 8 and the NSHipster article on UISplitViewController.

The most common issue is that PSPDFViewController is not pushed to the correct navigation controller by default, causing problems with the user interface or the bar button items. Please make sure to correctly manage collapsing and expanding of the split view controller and to handle showing PSPDFViewController on the currently visible and correct navigation controller, which is not as straightforward as you might think it is.

For further information, have a look at the PSCSplitViewController class inside the PSPDFCatalog example project. You can see how to configure a split view controller containing a list of documents on one side and a document view on the other side. Additionally, managing of collapsed and expanded view controllers is specifically handled and it's quite tricky. The most noteworthy methods include the following ones:

  • splitViewController:collapseSecondaryViewController:ontoPrimaryViewController:
  • splitViewController:separateSecondaryViewControllerFromPrimaryViewController
  • documentPickerController:didSelectDocument:pageIndex:searchString:
Was this page helpful? We're happy to answer any questions.