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