Some test text!

Configuring a Document Viewer

In this document
chevron_rightPTTabbedDocumentViewController
chevron_rightTab Settings
chevron_rightAccess to child PTDocumentViewControllers
chevron_rightSummary
chevron_rightPTDocumentViewController
chevron_rightHiding buttons
chevron_rightAdding buttons
chevron_rightMoving buttons
chevron_rightChanging Icons
chevron_rightPTToolManager

The document viewer classes (PTDocumentViewController and PTTabbedDocumentViewController) come with a lot of built-in functionality, some of which may need to be modified to fit the specific needs of an app.

Because the document viewer classes are part of the open source Tools UI framework, it is possible to achieve virtually any required modification. That said, it is usually faster and more convenient to configure the viewers via APIs, which this guide describes.

linkPTTabbedDocumentViewController

The tabbed document view controller displays a collection of document viewer controllers in tabs.

linkTab Settings

Tabs can be disabled using the property, and the maximum number of allowed tabs can be set using .

linkAccess to child PTDocumentViewControllers

The current document view controller can be accessed via , and others via

To configure a document view controller before it is displayed, conform to and implement the PTTabbedDocumentViewControllerDelegate method

linkSummary

APIFunctionality
Enables/disables tabs.
Controls the maximum number of concurrent tabs.
The current PTDocumentViewController.
The PTDocumentViewController at the given index.
Access to a PTDocumentViewController that is about to be displayed.

linkPTDocumentViewController

The PTDocumentViewController

linkHiding buttons

The document view controller has a "hidden" property for each button, so hiding one is a simple matter of setting it to yes:

linkAdding buttons

Buttons can be added by accessing the appropriate BarButtonItem array and adding a button:

Adds a button to the top navigation bar:

linkMoving buttons

The default buttons are all accessible via properties, making it easy to rearrange or move them. The following code swaps the position of the search button and navigation lists button:

linkChanging Icons

The icons of existing buttons may be changed by creating new UIBarButtonItems that have the same target and action as an existing item, and replacing the existing item with the new item:

linkPTToolManager

The PTToolManager is a class that coordinates the UI controls and interaction tools. It provides the ability to customize tool behavior, and enable/disable the ability for users to create or edit annotations (both in general and on an annotation type by annotation type basis).

To disable (or re-enable) the ability to annotate, options can be altered as in the example below. When disabled, the relevant annotation tool is removed from the annotation toolbar, and from the UIMenuController.