PSPDFToolbar
Objective-C
@interface PSPDFToolbar : UIView
Swift
class Toolbar : 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 usePSPDFToolbarButton
and its subclasses. UsePSPDFToolbarSpacerButton
to add fixed or flexible space to the toolbar. This will set theisPointerInteractionEnabled
property of the buttons to true.Declaration
Objective-C
@property (nonatomic, copy) 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 (nonatomic, nullable) UIView *backgroundView;
Swift
var backgroundView: UIView? { get set }
-
The container view for all toolbar buttons.
Declaration
Objective-C
@property (nonatomic, readonly) 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 (nonatomic, nullable) UIColor *barTintColor;
Swift
var barTintColor: UIColor? { get set }
-
Appearance style to be used by the for the standard height toolbar. Gets passed on to the background view setting its
standardAppearance
if implemented, otherwise itsnil
.Note
Resets to nil when thebackgroundView
is changed.Declaration
Objective-C
@property (nonatomic, copy, nullable) UIToolbarAppearance *standardAppearance;
Swift
@NSCopying var standardAppearance: UIToolbarAppearance? { get set }
-
Appearance style to be used by the for the compact height toolbar. Gets passed on to the background view setting its
compactAppearance
if implemented, otherwise itsnil
.Note
Resets to nil when thebackgroundView
is changed.Declaration
Objective-C
@property (nonatomic, copy, nullable) UIToolbarAppearance *compactAppearance;
Swift
@NSCopying var compactAppearance: UIToolbarAppearance? { get set }
-
The fixed toolbar dimension (height of width depending on the orientation). Defaults to PSPDFToolbarDefaultFixedDimensionLength.
Declaration
Objective-C
@property (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 bePSPDFToolbarButton
with thecollapsible
flag set to yes.Declaration
Objective-C
@property (nonatomic, copy, readonly) 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
collapsedButtonsDeclaration
Objective-C
@property (nonatomic, readonly) UIButton *_Nonnull collapsedButton;
Swift
var collapsedButton: UIButton { get }
-
Override to adjust the content view layout before button layout is called.
-
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 (nonatomic, readonly, getter=isHorizontal) BOOL horizontal;
Swift
var isHorizontal: Bool { get }
-
Spacing between buttons. Automatically computed based on
fixedDimension
.Declaration
Objective-C
@property (nonatomic, readonly) CGFloat buttonSpacing;
Swift
var buttonSpacing: CGFloat { get }