Toolbar

  • The annotation toolbar allows the creation of most annotation types supported by PSPDFKit.

    To customize which annotation icons should be displayed, edit editableAnnotationTypes in PSPDFDocument. Further appearance customization options are documented in the superclass header (PSPDFFlexibleToolbar.h).

    PSPDFAnnotationToolbar needs to be used together with a PSPDFFlexibleToolbarContainerView just like its superclass PSPDFFlexibleToolbar.

    Note

    Directly updating buttons will not work. Use additionalButtons if you want to add custom buttons.
    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotationToolbar
        : PSPDFFlexibleToolbar <PSPDFAnnotationStateManagerDelegate,
                                PSPDFOverridable>

    Swift

    class AnnotationToolbar : FlexibleToolbar, AnnotationStateManagerDelegate, Overridable
  • Helper for showing/hiding the toolbar on a view controller. Internally manages a PSPDFFlexibleToolbarContainer.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFAnnotationToolbarController
        : PSPDFFlexibleToolbarController <PSPDFOverridable>

    Swift

    class AnnotationToolbarController : FlexibleToolbarController, Overridable
  • A custom toolbar, that can dragged around the screen and anchored to different positions.

    This class holds an array of UIButton objects. For best results use PSPDFToolbarButton or one of its subclasses. PSPDFFlexibleToolbar should be used in combination with a PSPDFFlexibleToolbarContainer instance. The bar’s visual appearance can be customized using UIAppearance compliant properties.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFlexibleToolbar : PSPDFToolbar

    Swift

    class FlexibleToolbar : Toolbar
  • The flexible toolbar container holds and manages a PSPDFFlexibleToolbar instance. Its main responsibilities include toolbar anchoring and drag & drop handling. Add this view to your view hierarchy (a good candidate might be the UINavigationController’s view).

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFlexibleToolbarContainer : UIView

    Swift

    class FlexibleToolbarContainer : UIView
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PSPDFFlexibleToolbarController : NSObject<PSPDFFlexibleToolbarContainerDelegate>
    
    PSPDF_EMPTY_INIT_UNAVAILABLE
    
    /// Initialize with toolbar. Required.
    - (instancetype)initWithToolbar:(PSPDFFlexibleToolbar *)toolbar NS_DESIGNATED_INITIALIZER;
    
    /// Displayed toolbar.
    @property (nonatomic, readonly) PSPDFFlexibleToolbar *toolbar;
    
    /// The flexible toolbar container. Set to `nil` when the toolbar is not visible.
    @property (nonatomic, readonly, nullable) PSPDFFlexibleToolbarContainer *flexibleToolbarContainer;
    
    /// Returns YES whenever the toolbar is visible. If the toolbar is currently animating out, this will be already set to NO.
    @property (nonatomic, getter=isToolbarVisible, readonly) BOOL toolbarVisible;
    
    /// Shows or hides the toolbar (animated).
    - (void)toggleToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock;
    
    /// Show the toolbar, if not currently visible.
    ///
    /// @return Whether the toolbar was actually shown.
    /// @note Configure the `hostView` before first showing the toolbar.
    - (BOOL)showToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock;
    
    /// Hide the toolbar, if currently shown.
    ///
    /// @return Whether the toolbar was actually hidden.
    - (BOOL)hideToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock;
    
    /// Configures the `hostView`, `hostToolbar` and `hostViewController` for your setup.
    ///
    /// @property hostView Can be nil unless it's an unusual setup. When `nil`, `viewController` or `container` are used to determine an appropriate host view.
    /// @property container Might be a `UIBarButtonItem` or a `UIView` class that sits on the `hostToolbar`. If `nil`, the parent bar will be inferred from the `viewController`.
    /// @property viewController A hook will be installed, if non-nil, to auto-hide the toolbar as the controller disappears.
    - (void)updateHostView:(nullable UIView *)hostView container:(nullable id)container viewController:(nullable UIViewController *)viewController;
    
    /// The host view for the `PSPDFFlexibleToolbarContainer`.
    ///
    /// @see `updateHostView:container:viewController:`
    @property (nonatomic, readonly, nullable) UIView *hostView;
    
    /// The UIToolbar / UINavigationBar that is used to anchor the toolbar.
    ///
    /// @see `updateHostView:container:viewController:`
    @property (nonatomic, readonly, nullable) UIView<PSPDFSystemBar> *hostToolbar;
    
    /// The view controller that is presenting the toolbar.
    ///
    /// @see `updateHostView:container:viewController:`
    @property (nonatomic, weak, readonly) UIViewController *hostViewController;
    
    @end

    Swift

    class FlexibleToolbarController : NSObject, FlexibleToolbarContainerDelegate
  • Manages and displays an array of buttons as a toolbar. Similar to UIToolbar, but operates on UIButtons directly and allows for a bit more flexibility during layout. Also provides some more advanced functionality like smart automatic overflow handling.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFToolbar : UIView

    Swift

    class Toolbar : UIView
  • A UIButton subclass that mimic the appearance of plain style UIBarButtonItems.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFToolbarButton : PSPDFButton <PSPDFOverridable>

    Swift

    class ToolbarButton : PDFButton, Overridable
  • Toolbar drag & drop indicator view.

    See more

    Declaration

    Objective-C

    
    @interface PSPDFFlexibleToolbarDragView : UIView

    Swift

    class FlexibleToolbarDragView : UIView