PSPDFToolbar


@interface PSPDFToolbar : UIView

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.

  • Currently set buttons. Needs to be an array of UIButton instances. For best results use PSPDFToolbarButton and its subclasses. Use PSPDFToolbarSpacerButton to add fixed or flexible space to the toolbar.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<__kindof UIButton *> *_Nonnull buttons;

    Swift

    var buttons: [UIButton] { get set }
  • Sets the buttons and optionally performs a cross-fade animation between the previous and new button set.

    Declaration

    Objective-C

    - (void)setButtons:(nonnull NSArray<__kindof UIButton *> *)buttons
              animated:(BOOL)animated;

    Swift

    func setButtons(_ buttons: [UIButton], animated: Bool)
  • A view placed behind the toolbar items. Defaults to a custom view that mimics the system toolbar / navigation bar design.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) UIView *backgroundView;

    Swift

    var backgroundView: UIView? { get set }
  • The container view for all toolbar buttons.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView *_Nonnull contentView;

    Swift

    var contentView: UIView { get }
  • The bar tint color. Gets passed on to the background view (setting its barTintColor if implemented, otherwise its backgroundColor).

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) UIColor *barTintColor;

    Swift

    var barTintColor: UIColor? { get set }
  • The fixed toolbar dimension (height of width depending on the orientation). Defaults to PSPDFToolbarDefaultFixedDimensionLength.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat fixedDimension;

    Swift

    var fixedDimension: CGFloat { get set }
  • An array of buttons that have been collapsed into collapsedButton due to lack of toolbar space. Collapsible buttons need to be PSPDFToolbarButton with the collapsible flag set to yes.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<__kindof UIButton *> *_Nonnull collapsedButtons;

    Swift

    var collapsedButtons: [UIButton] { get }
  • Added to the toolbar when toolbar buttons get collapsed due to lack of toolbar space. - see: collapsedButtons

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIButton *_Nonnull collapsedButton;

    Swift

    var collapsedButton: UIButton { get }
  • Override to adjust the content view layout before button layout is called.

    Declaration

    Objective-C

    - (void)layoutMainSubviews;

    Swift

    func layoutMainSubviews()
  • Called when the collapsed button is added or removed.

    Declaration

    Objective-C

    - (void)setCollapsedButtonVisible:(BOOL)visible;

    Swift

    func setCollapsedButtonVisible(_ visible: Bool)
  • Indicates if the toolbar buttons should be laid out vertically or horizontally. Based on the frame size by default.

    Declaration

    Objective-C

    @property (readonly, getter=isHorizontal, nonatomic) BOOL horizontal;

    Swift

    var isHorizontal: Bool { get }
  • Spacing between buttons. Automatically computed based on fixedDimension.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGFloat buttonSpacing;

    Swift

    var buttonSpacing: CGFloat { get }