PSPDFTabbedViewController

Objective-C


@interface PSPDFTabbedViewController : PSPDFMultiDocumentViewController

Swift

class PDFTabbedViewController : MultiDocumentViewController

Displays multiple Documents, which can be easily switched using a top tab bar.

Defaults to not showing the document title in the navigation bar and in the overlay, because the title is already displayed in the tab. You can change this behavior by modifying the showTitle property.

By default the tabbed bar will not be shown if the documents array is empty. Use the barHidingMode property to change this.

  • Inserts a document at the end of the tabbed bar, optionally making it the visible document. If documents already contains document then it will not be added again, but may become visible. If documents is empty then the added document will always be made visible, ignoring the value of shouldMakeDocumentVisible.

    Declaration

    Objective-C

    - (void)addDocument:(nonnull PSPDFDocument *)document
            makeVisible:(BOOL)shouldMakeDocumentVisible
               animated:(BOOL)animated;

    Swift

    func addDocument(_ document: Document, makeVisible shouldMakeDocumentVisible: Bool, animated: Bool)
  • Inserts a document into the tabbed bar after the current visible document, optionally making it the new visible document. If documents already contains document then it will not be inserted again or moved, but may become visible. If documents is empty then the added document will always be made visible, ignoring the value of shouldMakeDocumentVisible.

    Declaration

    Objective-C

    - (void)insertDocumentAfterVisibleDocument:(nonnull PSPDFDocument *)document
                                   makeVisible:(BOOL)shouldMakeDocumentVisible
                                      animated:(BOOL)animated;

    Swift

    func insertDocument(afterVisibleDocument document: Document, makeVisible shouldMakeDocumentVisible: Bool, animated: Bool)
  • Inserts a document into the tabbed bar at the specified index, optionally making it the visible document. If documents already contains document then it will not be inserted again or moved, but may become visible. If documents is empty then the added document will always be made visible, ignoring the value of shouldMakeDocumentVisible.

    Declaration

    Objective-C

    - (void)insertDocument:(nonnull PSPDFDocument *)document
                   atIndex:(NSUInteger)idx
               makeVisible:(BOOL)shouldMakeDocumentVisible
                  animated:(BOOL)animated;

    Swift

    func insertDocument(_ document: Document, at idx: UInt, makeVisible shouldMakeDocumentVisible: Bool, animated: Bool)
  • Removes a document at a specified index in documents from the tabbed bar. Raises NSRangeException is idx is outside the range of documents.

    Declaration

    Objective-C

    - (void)removeDocumentAtIndex:(NSUInteger)idx animated:(BOOL)animated;

    Swift

    func removeDocument(at idx: UInt, animated: Bool)
  • Removes a specified document from the tabbed bar. Does nothing if documents does not contain document.

    Declaration

    Objective-C

    - (BOOL)removeDocument:(nonnull PSPDFDocument *)document
                  animated:(BOOL)animated;

    Swift

    func removeDocument(_ document: Document, animated: Bool) -> Bool
  • Changes the currently visible document and optionally scrolls the tabbed bar to make the new selected tab visible.

    Declaration

    Objective-C

    - (void)setVisibleDocument:(nullable PSPDFDocument *)visibleDocument
              scrollToPosition:(BOOL)scrollToPosition
                      animated:(BOOL)animated;

    Swift

    func setVisibleDocument(_ visibleDocument: Document?, scrollToPosition: Bool, animated: Bool)
  • Delegate to capture events.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<PSPDFTabbedViewControllerDelegate> _Nullable delegate;

    Swift

    @IBOutlet weak var delegate: PDFTabbedViewControllerDelegate? { get set }
  • Defaults to PSPDFTabbedDocumentsPersistKey. Change if you use multiple instances of PDFTabbedViewController.

    Declaration

    Objective-C

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

    Swift

    var statePersistenceKey: String { get set }
  • The bar that shows tabs for switching between documents. Its appearance is customizable.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFTabbedBar *_Nonnull tabbedBar;

    Swift

    var tabbedBar: PSPDFTabbedBar { get }
  • The document picker controller to be shown when the tabbed bar’s document picker button has been tapped. The default is nil. Set this property to enable the document picker button. If the document picker controller has no delegate at the time of presentation, the tabbed PDF controller will provide the delegate.

    Declaration

    Objective-C

    @property (nonatomic, nullable) PSPDFDocumentPickerController *documentPickerController;

    Swift

    var documentPickerController: PSPDFDocumentPickerController? { get set }
  • Whether the tabbed bar should be shown or hidden depending on if there are loaded documents. The default is .automatic if documentPickerController is nil, or .show if documentPickerController is non-nil. This property only affects the visibility of tabbedBar, not the tabs ornament on visionOS. Therefore on visionOS when the mainToolbarMode is set to .ornament, the default value of this is .hide, and setting it to any other value is not supported.

    Declaration

    Objective-C

    @property (nonatomic) PSPDFTabbedViewControllerBarHidingMode barHidingMode;

    Swift

    var barHidingMode: PDFTabbedViewController.BarHidingMode { get set }
  • Determines how the user is able to close documents, which is possible using the close buttons in PSPDFTabbedBar and swipe-to-delete in PSPDFMultiDocumentListController. The default is .onlySelectedTab.

    Declaration

    Objective-C

    @property (nonatomic) PSPDFTabbedViewControllerCloseMode closeMode;

    Swift

    var closeMode: PDFTabbedViewController.CloseMode { get set }
  • A Boolean value that determines whether a PDF action that opens another PDF document should show this document in a separate tab. The default is true. If false, the document of the current tab will be changed and the old visible document will be replaced in documents. If the target document is already in documents, then the selected tab will change to show it whatever the value of this property.

    Declaration

    Objective-C

    @property (nonatomic) BOOL openDocumentActionInNewTab;

    Swift

    var openDocumentActionInNewTab: Bool { get set }
  • Defines if dragging tabs from this tabbed bar to another tabbed bar should be allowed.

    If this is allowed, documents from this tabbed bar can be moved to another tabbed bars in the same app, when showing multiple tabbed view controllers.

    Defaults to false.

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowDraggingTabsToExternalTabbedBar;

    Swift

    var allowDraggingTabsToExternalTabbedBar: Bool { get set }
  • Defines if dropping tabs from other tabbed bars in this tabbed bar should be allowed.

    If this is allowed, documents can be moved to this tabbed bars from the same app, when showing multiple tabbed view controllers.

    Defaults to false.

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowDroppingTabsFromExternalTabbedBar;

    Swift

    var allowDroppingTabsFromExternalTabbedBar: Bool { get set }
  • Defines if the tabbed bar allows reordering documents via drag and drop.

    Defaults to true.

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowReorderingDocuments;

    Swift

    var allowReorderingDocuments: Bool { get set }
  • Updates the frame of the tabbed bar. It is not usually necessary to call this, but do so if the navigation bar height changes, for example by setting a prompt while the tabbed bar is visible. If the navigation bar has just started animating, this will animate the tabbed bar alongside.

    Declaration

    Objective-C

    - (void)updateTabbedBarFrameAnimated:(BOOL)animated;

    Swift

    func updateTabbedBarFrame(animated: Bool)