PTTabbedDocumentViewController


@interface PTTabbedDocumentViewController : UIViewController <PTOverridable>

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

  • Returns an initialized PTTabbedDocumentViewController instance.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()

    Return Value

    an initialized PTTabbedDocumentViewController instance.

  • 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.

  • Open a document with the given URL and options.

    Declaration

    Objective-C

    - (void)openDocumentWithURL:(nonnull NSURL *)url
                        options:(nullable PTDocumentOptions *)options;

    Swift

    func openDocument(with url: URL, options: PTDocumentOptions?)

    Parameters

    url

    The URL to open.

    options

    The options to use in opening 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 (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 (nonatomic) NSUInteger maximumTabCount;

    Swift

    var maximumTabCount: UInt { get set }
  • The tab manager used to track the list of tabs and the selected tab.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PTDocumentTabManager *_Nonnull tabManager;

    Swift

    var tabManager: PTDocumentTabManager { get }
  • The document tab bar used to display the tabs

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PTDocumentTabBar *_Nonnull tabBar;

    Swift

    var tabBar: PTDocumentTabBar { get }
  • 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 (nonatomic, copy, readonly) NSArray<NSURL *> *_Nonnull tabURLs;

    Swift

    var tabURLs: [URL] { get }
  • Returns the document view controller at the specified tab index.

    Declaration

    Objective-C

    - (nullable __kindof PTDocumentBaseViewController *)
        documentViewControllerAtIndex:(NSUInteger)index;

    Swift

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

    Parameters

    index

    the view controller’s tab index

    Return Value

    the document view controller 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 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
                 password:(nullable NSString *)password
                 selected:(BOOL)selected;

    Swift

    func addTab(with url: URL, password: String?, selected: Bool)

    Parameters

    url

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

    password

    The password for the document.

    selected

    Whether to select the tab after it has been added.

  • 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
                  options:(nullable PTDocumentOptions *)options
                 selected:(BOOL)selected;

    Swift

    func addTab(with url: URL, options: PTDocumentOptions?, selected: Bool)

    Parameters

    url

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

    options

    The options to use for the document.

    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.

  • 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
                    password:(nullable NSString *)password
                     atIndex:(NSUInteger)index
                    selected:(BOOL)selected;

    Swift

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

    Parameters

    url

    The URL to add to the tab bar.

    password

    The password for the document.

    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.

  • 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
                     options:(nullable PTDocumentOptions *)options
                     atIndex:(NSUInteger)index
                    selected:(BOOL)selected;

    Swift

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

    Parameters

    url

    The URL to add to the tab bar.

    options

    The options to use for the document.

    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 for the given document view controller.

    Declaration

    Objective-C

    - (void)removeTabForViewController:
        (nonnull PTDocumentBaseViewController *)viewController;

    Swift

    func removeTab(for viewController: PTDocumentBaseViewController)

    Parameters

    viewController

    The view controller of the tab to remove.

  • 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.

  • Shows a list of all the tabs in the view controller.

    Declaration

    Objective-C

    - (void)showTabsList:(nonnull id)sender;

    Swift

    func showTabsList(_ sender: Any)
  • This method is called when the tabs are modified e.g. added, removed, rearranged.

    Declaration

    Objective-C

    - (void)tabsDidChange;

    Swift

    func tabsDidChange()
  • The URL associated with the currently selected tab.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) NSURL *selectedURL;

    Swift

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

    If there is no currently selected tab, the value is NSNotFound.

    Declaration

    Objective-C

    @property (nonatomic) NSUInteger selectedIndex;

    Swift

    var selectedIndex: UInt { get set }
  • The currently selected document view controller.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) __kindof PTDocumentBaseViewController *selectedViewController;

    Swift

    var selectedViewController: PTDocumentBaseViewController? { 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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isTabBarHidden) 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.

  • The PTDocumentBaseViewController subclass used for new tabs.

    The default class is PTDocumentController.

    Declaration

    Objective-C

    @property (nonatomic, null_resettable) Class viewControllerClass;

    Swift

    var viewControllerClass: AnyClass! { get set }
  • The delegate of the tabbed document view controller object.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<PTTabbedDocumentViewControllerDelegate> delegate;

    Swift

    weak var delegate: (any PTTabbedDocumentViewControllerDelegate)? { get set }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;

    Swift

    init(coder aDecoder: NSCoder)
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;