PSPDFDocumentEditorToolbarController

Manages the document editor toolbar state and presents various document editing controllers.

Note

This class requires the Document Editor component to be enabled for your license.
  • Shows or hides the new page view controller, depending on whether it is already visible.

    Declaration

    Objective-C

    - (nullable PSPDFNewPageViewController *)
        toggleNewPageController:(nullable id)sender
            presentationOptions:(nullable NSDictionary<NSString *, id> *)options;

    Swift

    func toggleNewPageController(_ sender: Any?, presentationOptions options: [String : Any]? = nil) -> PSPDFNewPageViewController?

    Parameters

    sender

    A UIView or UIBarButtonItem used as the anchor view for the popover controller (iPad only).

    options

    A dictionary of presentation options. See PSPDFPresentationActions.h for possible values.

  • Shows or hides a confirmation view controller to let the user decide how the changes should be handled.

    By default, this method presents the view controller returned from -[PSPDFDocumentEditorToolbarController savingConfirmationControllerForSender:completionHandler:].

    To avoid showing any confirmation UI to the user, override this method and implement your custom saving logic without calling super.

    Declaration

    Objective-C

    - (nullable UIViewController *)
        toggleSavingConfirmationViewController:(nullable id)sender
                           presentationOptions:
                               (nullable NSDictionary<NSString *, id> *)options
                             completionHandler:
                                 (nullable void (^)(BOOL))completionHandler;

    Swift

    func toggleSavingConfirmationViewController(_ sender: Any?, presentationOptions options: [String : Any]? = nil, completionHandler: ((Bool) -> Void)? = nil) -> UIViewController?

    Parameters

    sender

    A UIView or UIBarButtonItem used as the anchor view for the popover controller (iPad only).

    options

    A dictionary of presentation options. See PSPDFPresentationActions.h for possible values.

    completionHandler

    A completion callback, called when saving completes. Might be called after the save controller completes if Save As… is selected. If cancelled is yes, the save flow was interrupted.

  • Shows or hides a view controller with saving options.

    Declaration

    Objective-C

    - (nullable PSPDFSaveViewController *)
        toggleSaveController:(nullable id)sender
         presentationOptions:(nullable NSDictionary<NSString *, id> *)options
           completionHandler:(nullable void (^)(BOOL))completionHandler;

    Swift

    func toggleSave(_ sender: Any?, presentationOptions options: [String : Any]? = nil, completionHandler: ((Bool) -> Void)? = nil) -> PSPDFSaveViewController?

    Parameters

    sender

    A UIView or UIBarButtonItem used as the anchor view for the popover controller (iPad only).

    options

    A dictionary of presentation options. See PSPDFPresentationActions.h for possible values.

    completionHandler

    A completion callback, called when saving completes. If cancelled is YES, the save flow was interrupted.

  • Returns a view controller that allows the user to choose how they want the changes on the underlying document to be handled.

    By default, this method returns a preconfigured UIAlertController instance with 4 available options:

    • Save (only available if the document is writable)
    • Save As
    • Discard Changes
    • Cancel

    You can override this method to return a custom view controller that presents the available options in a custom manner.

    When overriding this method to provide your custom alert logic, you need to perform the appropriate checks to make sure the actions of the returned alert controller are valid for the current context, and that they perform the appropriate actions on the underlying document. See PSPDFDocumentEditor.

    To avoid any confirmation UI from being shown, override - toggleSavingConfirmationViewController:presentationOptions:completionHandler: and implement your custom saving logic there without calling super.

    Declaration

    Objective-C

    - (nonnull UIViewController *)
        savingConfirmationControllerForSender:(nullable id)sender
                            completionHandler:
                                (nullable void (^)(BOOL))completionHandler;

    Swift

    func savingConfirmationControllerForSender(_ sender: Any?, completionHandler: ((Bool) -> Void)? = nil) -> UIViewController

    Parameters

    sender

    A UIView or UIBarButtonItem used as the anchor view for the popover controller (iPad only).

    completionHandler

    A completion callback, called when saving completes. Might be called after the save controller completes if Save As… is selected. If cancelled is yes, the save flow was interrupted.