PSPDFFlexibleToolbarController

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).
///
/// @note The `completionBlock` will not be called if the toolbar is currently
/// animating or if host view could not be determined.
- (void)toggleToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock PSPDF_SWIFT_DISABLE_ASYNC;

/// Show the toolbar, if not currently visible.
///
/// @return Whether the toolbar was actually shown.
/// @note Configure the `hostView` before first showing the toolbar.
///
/// @note The `completionBlock` will not be called if the toolbar is currently
/// animating or if host view could not be determined or if the toolbar is
/// already visible.
- (BOOL)showToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock PSPDF_SWIFT_DISABLE_ASYNC;

/// Hide the toolbar, if currently shown.
///
/// @return Whether the toolbar was actually hidden.
///
/// @note The `completionBlock` will not be called if the toolbar is currently
/// animating or if the toolbar is already hidden.
- (BOOL)hideToolbarAnimated:(BOOL)animated completion:(nullable void (^)(BOOL finished))completionBlock PSPDF_SWIFT_DISABLE_ASYNC;

/// 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

Undocumented

  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • Unavailable

    Not the designated initializer

    Undocumented

    Declaration

    Objective-C

    PSPDF_EMPTY_INIT_UNAVAILABLE
  • Initialize with toolbar. Required.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithToolbar:(nonnull PSPDFFlexibleToolbar *)toolbar;

    Swift

    init(toolbar: FlexibleToolbar)
  • Displayed toolbar.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PSPDFFlexibleToolbar *_Nonnull toolbar;

    Swift

    var toolbar: FlexibleToolbar { get }
  • The flexible toolbar container. Set to nil when the toolbar is not visible.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) PSPDFFlexibleToolbarContainer *flexibleToolbarContainer;

    Swift

    var flexibleToolbarContainer: FlexibleToolbarContainer? { get }
  • Returns YES whenever the toolbar is visible. If the toolbar is currently animating out, this will be already set to NO.

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isToolbarVisible) BOOL toolbarVisible;

    Swift

    var isToolbarVisible: Bool { get }
  • Shows or hides the toolbar (animated).

    Note

    The completionBlock will not be called if the toolbar is currently animating or if host view could not be determined.

    Declaration

    Objective-C

    - (void)toggleToolbarAnimated:(BOOL)animated
                       completion:(nullable void (^)(BOOL))completionBlock;

    Swift

    func toggleToolbar(animated: Bool, completion completionBlock: ((Bool) -> Void)? = nil)
  • Show the toolbar, if not currently visible.

    Note

    Configure the hostView before first showing the toolbar.

    Note

    The completionBlock will not be called if the toolbar is currently animating or if host view could not be determined or if the toolbar is already visible.

    Declaration

    Objective-C

    - (BOOL)showToolbarAnimated:(BOOL)animated
                     completion:(nullable void (^)(BOOL))completionBlock;

    Swift

    func showToolbar(animated: Bool, completion completionBlock: ((Bool) -> Void)? = nil) -> Bool

    Return Value

    Whether the toolbar was actually shown.

  • Hide the toolbar, if currently shown.

    Note

    The completionBlock will not be called if the toolbar is currently animating or if the toolbar is already hidden.

    Declaration

    Objective-C

    - (BOOL)hideToolbarAnimated:(BOOL)animated
                     completion:(nullable void (^)(BOOL))completionBlock;

    Swift

    func hideToolbar(animated: Bool, completion completionBlock: ((Bool) -> Void)? = nil) -> Bool

    Return Value

    Whether the toolbar was actually hidden.

  • 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.

    Declaration

    Objective-C

    - (void)updateHostView:(nullable UIView *)hostView
                 container:(nullable id)container
            viewController:(nullable UIViewController *)viewController;

    Swift

    func updateHostView(_ hostView: UIView?, container: Any?, viewController: UIViewController?)
  • The host view for the PSPDFFlexibleToolbarContainer.

    See

    updateHostView:container:viewController:

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIView *hostView;

    Swift

    var hostView: UIView? { get }
  • The UIToolbar / UINavigationBar that is used to anchor the toolbar.

    See

    updateHostView:container:viewController:

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) UIView<PSPDFSystemBar> *hostToolbar;

    Swift

    var hostToolbar: (UIView & SystemBar)? { get }
  • The view controller that is presenting the toolbar.

    See

    updateHostView:container:viewController:

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) UIViewController *_Nullable hostViewController;

    Swift

    weak var hostViewController: UIViewController? { get }