Handle Displaying Documents in UISplitViewController

A split view controller often seems like the ideal solution for displaying a list of documents (for example, for using the PDFDocumentPickerController) in one view controller and displaying a PDFViewController in another view controller. But beware, as there’s a lot going on behind the scenes of UISplitViewController that will mess with your expected behavior. To get more insight on how the split view controller works, take a look at the NSHipster article on UISplitViewController.

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

For more information, have a look at the PSCSplitViewController class inside the PSPDFKit Catalog 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, there are special methods for managing collapsed and expanded view controllers. Here are some of the most noteworthy methods: