PSPDFNavigationItem


@interface PSPDFNavigationItem : UINavigationItem

PSPDFNavigationItem handles the left and right bar button items for different view modes.

This type of navigation item enables you to assign left and right bar button items based on the view mode, so that every view mode can have different bar button items displayed in the navigation bar.

The navigation item and the corresponding view controller ensure that displayed bar button items are are updated correctly when the view mode changes.

  • The button that is used as the close button in presentation contexts.

    This property should always be set. The managing view controller takes care about showing or hiding this button as necessary.

    If you set this property to nil, you need to take care of the cases where the related view controller may be presented modally yourself.

    Note

    The close button may be included in the array returned by leftBarButtonItems depending on whether the close button is currently visible or not. You should not call this method but instead call leftBarButtonItemsForViewMode: which will not return this button either way.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable)
        UIBarButtonItem *closeBarButtonItem;

    Swift

    var closeBarButtonItem: UIBarButtonItem? { get set }
  • Gets the left bar button items that are assigned to passed in view mode.

    Declaration

    Objective-C

    - (nullable NSArray<UIBarButtonItem *> *)leftBarButtonItemsForViewMode:
        (PSPDFViewMode)viewMode;

    Swift

    func leftBarButtonItems(for viewMode: PSPDFViewMode) -> [UIBarButtonItem]?

    Parameters

    viewMode

    The view mode that you are interested in.

    Return Value

    The bar button items assigned to the view mode.

  • Sets the left bar button items for a specific view mode, eiter animated or not.

    Note

    This does not change the view mode, this only associated the passed in items with the passed in view mode.

    Declaration

    Objective-C

    - (void)setLeftBarButtonItems:
                (nonnull NSArray<UIBarButtonItem *> *)barButtonItems
                      forViewMode:(PSPDFViewMode)viewMode
                         animated:(BOOL)animated;

    Swift

    func setLeftBarButtonItems(_ barButtonItems: [UIBarButtonItem], for viewMode: PSPDFViewMode, animated: Bool)

    Parameters

    barButtonItems

    The items to associate with viewMode.

    viewMode

    The view mode to associate with items.

    animated

    YES if you want to animate the change. This value is only of relevance if the passed in viewMode is the current view mode.

  • Sets the left bar button items for all view modes.

    Declaration

    Objective-C

    - (void)setLeftBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items
                         animated:(BOOL)animated;

    Swift

    func setLeftBarButtonItems(_ items: [UIBarButtonItem]?, animated: Bool)

    Parameters

    items

    The items to associate with all view modes.

    animated

    YES if you want the change for the current view mode to be animated.

  • Gets the right bar button items that are assigned to passed in view mode.

    Declaration

    Objective-C

    - (nullable NSArray<UIBarButtonItem *> *)rightBarButtonItemsForViewMode:
        (PSPDFViewMode)viewMode;

    Swift

    func rightBarButtonItems(for viewMode: PSPDFViewMode) -> [UIBarButtonItem]?

    Parameters

    viewMode

    The view mode that you are interested in.

    Return Value

    The bar button items assigned to the view mode.

  • Sets the right bar button items for a specific view mode, eiter animated or not.

    Note

    This does not change the view mode, this only associated the passed in items with the passed in view mode.

    Declaration

    Objective-C

    - (void)setRightBarButtonItems:
                (nonnull NSArray<UIBarButtonItem *> *)barButtonItems
                       forViewMode:(PSPDFViewMode)viewMode
                          animated:(BOOL)animated;

    Swift

    func setRightBarButtonItems(_ barButtonItems: [UIBarButtonItem], for viewMode: PSPDFViewMode, animated: Bool)

    Parameters

    barButtonItems

    The items to associate with viewMode.

    viewMode

    The view mode to associate with items.

    animated

    YES if you want to animate the change. This value is only of relevance if the passed in viewMode is the current view mode.

  • Sets the right bar button items for all view modes.

    Declaration

    Objective-C

    - (void)setRightBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items
                          animated:(BOOL)animated;

    Swift

    func setRightBarButtonItems(_ items: [UIBarButtonItem]?, animated: Bool)

    Parameters

    items

    The items to associate with all view modes.

    animated

    YES if you want the change for the current view mode to be animated.