PSPDFFlexibleToolbarContainer
Objective-C
@interface PSPDFFlexibleToolbarContainer : UIView
Swift
class FlexibleToolbarContainer : UIView
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).
-
Attached flexible toolbar.
Declaration
Objective-C
@property (nonatomic, nullable) PSPDFFlexibleToolbar *flexibleToolbar;
Swift
var flexibleToolbar: FlexibleToolbar? { get set }
-
A
UINavigationBar
orUIToolbar
instance, that should be automatically hidden when theflexibleToolbar
is in thePSPDFFlexibleToolbarPositionInTopBar
position.Declaration
Objective-C
@property (nonatomic, weak) UIView<PSPDFSystemBar> *_Nullable overlaidBar;
Swift
weak var overlaidBar: (UIView & SystemBar)? { get set }
-
true
when a toolbar drag is in progress,false
otherwise. Only relevant if dragging is enabled on the flexibleToolbar`. KVO observable.Declaration
Objective-C
@property (nonatomic, readonly) BOOL dragging;
Swift
var dragging: Bool { get }
-
Container delegate. (Can be freely set to any receiver)
Declaration
Objective-C
@property (nonatomic, weak) id<PSPDFFlexibleToolbarContainerDelegate> _Nullable containerDelegate;
Swift
@IBOutlet weak var containerDelegate: FlexibleToolbarContainerDelegate? { get set }
-
The background color used for anchor view. If not explicitly set the color defaults to the toolbar barTintColor, toolbar tintColor or default PSPDFKit color (first one that is set).
-
Shows the container, than calls through to the corresponding
PSPDFFlexibleToolbar
method (showToolbarAnimated:completion:
). Also hide the overlaidBar if needed (depending on the toolbar position). -
Hides the container and toolbar using hideAnimated:completion: and than removes the container from its superview. Internally used by the flick to close gesture. Should also be used by done / close buttons added to the toolbar.
-
Override this method to customize exact toolbar and anchor view placement.
Declaration
Objective-C
- (CGRect)rectForToolbarPosition:(PSPDFFlexibleToolbarPosition)toolbarPosition;
Swift
func rect(for toolbarPosition: FlexibleToolbar.Position) -> CGRect
-
Possible override point for custom toolbar position change animations. Use [self layoutIfNeeded]; in an animation block to apply the new toolbar position.
Declaration
Objective-C
- (void)animateToolbarPositionChangeFrom: (PSPDFFlexibleToolbarPosition)currentPosition to:(PSPDFFlexibleToolbarPosition) newPosition;
Swift
func animateToolbarPositionChange(from currentPosition: FlexibleToolbar.Position, to newPosition: FlexibleToolbar.Position)