List container to customize horizontal menu layout on iOS

The PTNavigationListsViewController class is a container view controller that shows the annotation list, document outline, and user-defined bookmark list controls with a UITabBarController-like interface. A segmented control is used to select which child view controller to display.

Apryse Docs Image

The navigation lists control is part of the Tools library, so make sure you have added the Tools library to your project.

Show a navigation lists view controller

To create a new navigation lists view controller and display it from another view controller, set the child list view controllers to the PTNavigationListsViewController class's listViewControllers property:

1// Initialize a new navigation lists view controller.
2let navigationListsViewController = PTNavigationListsViewController(toolManager: toolManager)
3
4// Initialize an annotation, outline, and bookmark view controller with a PTPDFViewCtrl instance.
5let annotationViewController = PTAnnotationViewController(pdfViewCtrl: pdfViewCtrl)
6annotationViewController.delegate = self
7
8let outlineViewController = PTOutlineViewController(pdfViewCtrl: pdfViewCtrl)
9outlineViewController.delegate = self
10
11let bookmarkViewController = PTBookmarkViewController(pdfViewCtrl: pdfViewCtrl)
12bookmarkViewController.delegate = self
13
14// Set the array of child view controllers to display.
15navigationListsViewController.listViewControllers = [outlineViewController, annotationViewController, bookmarkViewController]
16
17if ( UIDevice.current.userInterfaceIdiom == .pad ) {
18 navigationListsViewController.modalPresentationStyle = .popover
19 navigationListsViewController.popoverPresentationController?.barButtonItem = navigationListsButton
20} else {
21 navigationListsViewController.modalPresentationStyle = .fullScreen
22}
23
24self.present(navigationListsViewController, animated: true, completion: nil)

Presenting on iPads:

The navigation list view controller is designed to be presented in a popover on iPads. To do so, you must provide the PTNavigationListsViewController's UIPopoverPresentationController with either:

OR

as in the example above.

Customization

The PTNavigationListViewController provides a flexible API for displaying only the desired child view controllers. Any of the annotation list, document outline, or user-defined bookmark list view controllers can be removed by omitting them from the listViewControllers property. It is also possible to add a custom child view controller by adding it to the listViewControllers array.

To specify which of the child view controllers to display on opening the navigation list control, either the selectedIndex , or the selectedViewController property can be used.

1// Add a custom view controller to an existing navigation list control
2let customViewController = UIViewController()
3navigationListsViewController.listViewControllers?.append(customViewController)
4
5// Show the navigationListsViewController's annotationViewController on opening
6navigationListsViewController.selectedViewController = navigationListsViewController.annotationViewController
7// OR specify an index to show from the `listViewControllers` property
8navigationListsViewController.selectedIndex = 0

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales