PTTabbedDocumentViewController

@interface PTTabbedDocumentViewController : UIViewController

A container view controller that displays multiple documents with a tab bar control to allow switching between documents.

  • Returns an initialized PTTabbedDocumentViewController.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()

    Return Value

    an initialized PTTabbedDocumentViewController.

  • Open a document with the given URL.

    Declaration

    Objective-C

    - (void)openDocumentWithURL:(nonnull NSURL *)url;

    Swift

    func openDocument(with url: URL)

    Parameters

    url

    The URL to open.

  • Open a document with the given URL and password.

    Declaration

    Objective-C

    - (void)openDocumentWithURL:(nonnull NSURL *)url
                       password:(nullable NSString *)password;

    Swift

    func openDocument(with url: URL, password: String?)

    Parameters

    url

    The URL to open.

    password

    The password for the document.

  • Whether multiple tabs can be displayed.

    The default value of this property is YES. If tabs are disabled, the tab bar will be hidden and all tabs except the selected tab will be removed.

    Declaration

    Objective-C

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

    Swift

    var tabsEnabled: Bool { get set }
  • The maximum number of tabs allowed. There is no limit by default.

    When the maximum number of tabs is reached, adding subsequent tabs will remove other tabs to respect the limit.

    Note

    The value of this property must be greater than zero.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger maximumTabCount;

    Swift

    var maximumTabCount: UInt { get set }
  • An array of the URLs managed by the view controller and displayed by the tab bar interface. The tabs are displayed in the same order as in the array.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nonnull) NSArray<NSURL *> *tabURLs;

    Swift

    var tabURLs: [URL] { get set }
  • Returns the PTDocumentViewController at the specified tab index.

    Declaration

    Objective-C

    - (nullable PTDocumentViewController *)documentViewControllerAtIndex:
        (NSUInteger)index;

    Swift

    func documentViewController(at index: UInt) -> PTDocumentViewController?

    Parameters

    index

    the view controller’s tab index

    Return Value

    the PTDocumentViewController at the specified tab index, or nil if it is not loaded.

  • Inserts the given URL at the end of the tab bar.

    If the URL already exists in the view controller then it will not be re-added.

    Declaration

    Objective-C

    - (void)addTabWithURL:(nonnull NSURL *)url selected:(BOOL)selected;

    Swift

    func addTab(with url: URL, selected: Bool)

    Parameters

    url

    The URL to add to the end of the tab bar.

    selected

    Whether to select the tab after it has been added.

  • Inserts the given URL into the tab bar at the specified index.

    If the URL already exists in the view controller then it will not be re-added.

    Declaration

    Objective-C

    - (void)insertTabWithURL:(nonnull NSURL *)url
                     atIndex:(NSUInteger)index
                    selected:(BOOL)selected;

    Swift

    func insertTab(with url: URL, at index: UInt, selected: Bool)

    Parameters

    url

    The URL to add to the tab bar.

    index

    The index in the tab bar at which to insert the URL. This value must not be greater than the number of tabs in the tab bar.

    selected

    Whether to selected the tab after it has been inserted.

  • Removes the first occurence of the given URL in the tab bar.

    Declaration

    Objective-C

    - (void)removeTabWithURL:(nonnull NSURL *)url;

    Swift

    func removeTab(with url: URL)

    Parameters

    url

    The URL to remove from the tab bar.

  • Removes the tab at the given index.

    Declaration

    Objective-C

    - (void)removeTabAtIndex:(NSUInteger)index;

    Swift

    func removeTab(at index: UInt)

    Parameters

    index

    The index from which to remove the tab in the tab bar.

  • The URL associated with the currently selected tab.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) NSURL *selectedURL;

    Swift

    weak var selectedURL: NSURL? { get set }
  • The index of the tab URL associated with the currently selected tab.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger selectedIndex;

    Swift

    var selectedIndex: UInt { get set }
  • The currently selected PTDocumentViewController.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable)
        PTDocumentViewController *selectedViewController;

    Swift

    var selectedViewController: PTDocumentViewController? { get }
  • A Boolean value that indicates whether the tab bar is hidden.

    If YES, the tab bar is hidden. The default value is NO if the tabsEnabled property is enabled. Setting this property changes the visibility of the tab bar without animating the changes. If you want to animate the change, use the -setTabBarHidden:animated: method instead.

    Declaration

    Objective-C

    @property (getter=isTabBarHidden, assign, readwrite, nonatomic)
        BOOL tabBarHidden;

    Swift

    var isTabBarHidden: Bool { get set }
  • Sets whether the tab bar is hidden.

    For animated transitions, the duration of the animation is specified by the value in the UINavigationControllerHideShowBarDuration constant.

    Declaration

    Objective-C

    - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;

    Swift

    func setTabBarHidden(_ hidden: Bool, animated: Bool)

    Parameters

    hidden

    Specify YES to hide the tab bar or NO to show it

    animated

    Specify YES if you want to animate the change in visibility or NO if you want the tab bar to appear immediately.