PSPDFMultiDocumentViewController


@interface PSPDFMultiDocumentViewController : PSPDFBaseViewController

Allows displaying multiple PSPDFDocuments.

  • Initialize the controller. Set a custom pdfController to use a subclass. If nil, a default instance will be created.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPDFViewController:
        (nullable PSPDFViewController *)pdfController;

    Swift

    init(pdfViewController pdfController: PSPDFViewController?)
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFMultiDocumentViewController : PSPDFBaseViewController
  • Currently visible document.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        PSPDFDocument *visibleDocument;

    Swift

    var visibleDocument: PSPDFDocument? { get set }
  • Documents that are currently loaded.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<PSPDFDocument *> *_Nonnull documents;

    Swift

    var documents: [PSPDFDocument] { get set }
  • Delegate to capture events.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFMultiDocumentViewControllerDelegate> _Nullable delegate;

    Swift

    @IBOutlet weak var delegate: PSPDFMultiDocumentViewControllerDelegate? { get set }
  • Set to YES to enable automatic state persisting. Will be saved to NSUserDefaults. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL enableAutomaticStatePersistence;

    Swift

    var enableAutomaticStatePersistence: Bool { get set }
  • Persists the state to NSUserDefaults. - warning: Will only persist file-based documents, not documents based on NSData or CGDataProviders.

    Declaration

    Objective-C

    - (void)persistState;

    Swift

    func persistState()
  • Restores state from NSUserDefaults. Returns YES on success. Will set the visibleDocument that is saved in the state.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL restoreState;

    Swift

    var restoreState: Bool { get }
  • Restores the state and merges with new documents. First document in the array will be visibleDocument.

    Declaration

    Objective-C

    - (BOOL)restoreStateAndMergeWithDocuments:
        (nonnull NSArray<PSPDFDocument *> *)documents;

    Swift

    func restoreStateAndMerge(with documents: [PSPDFDocument]) -> Bool
  • Defaults to PSPDFMultiDocumentsPersistKey. Change if you use multiple instances of PSPDFMultiDocumentViewController.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic) NSString *_Nonnull statePersistenceKey;

    Swift

    var statePersistenceKey: String { get set }
  • The embedded PSPDFViewController. Access to customize the properties.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFViewController *_Nonnull pdfController;

    Swift

    var pdfController: PSPDFViewController { get }
  • A Boolean value specifying whether thumbnail view mode shows pages from all loaded documents. If YES, pages are shown from all loaded documents. If NO, only pages from the current visible document are shown. Defaults to NO.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL thumbnailViewIncludesAllDocuments;

    Swift

    var thumbnailViewIncludesAllDocuments: Bool { get set }
  • A Boolean value specifying whether title should be the title of the current visible document, and therefore shown in the navigation bar or in the overlay. When this is set to YES and there is enough space available in the navigation bar, the title will be displayed there, if not, the title will be displayed in the overlay. Defaults to NO, so no title is shown in the navigation bar or in the overlay.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL showTitle;

    Swift

    var showTitle: Bool { get set }
  • Override this initializer to allow all use cases (storyboard loading, etc) - note: The pdfController argument might be nil, but the property of the same name will be non-nil after calling the superclass’s implementation.

    Declaration

    Objective-C

    - (void)commonInitWithPDFController:
        (nullable PSPDFViewController *)pdfController;

    Swift

    func commonInit(withPDFController pdfController: PSPDFViewController?)
  • Returns the title of the loaded document at a specified index. Can be subclassed to customize what title should be set.

    Declaration

    Objective-C

    - (nonnull NSString *)titleForDocumentAtIndex:(NSUInteger)idx;

    Swift

    func titleForDocument(at idx: UInt) -> String
  • Called when the title of the document at idx changes. Override this to update views.

    Declaration

    Objective-C

    - (void)titleDidChangeForDocumentAtIndex:(NSUInteger)idx;

    Swift

    func titleDidChangeForDocument(at idx: UInt)
  • Persists the current view state. This method by default persists in an internal dictionary. Called any time the visible document changes at an optimal time to persist the view state.

    Note

    Can be overridden to disable automatic view state restoration.

    Declaration

    Objective-C

    - (void)persistViewStateForCurrentVisibleDocument;

    Swift

    func persistViewStateForCurrentVisibleDocument()
  • Restores the current view state from an internal dictionary, if found. Called any time the visible document changes at an optimal time to restore the view state.

    Note

    Can be overridden to disable automatic view state restoration.

    Declaration

    Objective-C

    - (void)restoreViewStateForCurrentVisibleDocument;

    Swift

    func restoreViewStateForCurrentVisibleDocument()