PSPDFDocumentEditorToolbarController
Objective-C
@interface PSPDFDocumentEditorToolbarController
: PSPDFFlexibleToolbarController <
PSPDFDocumentEditorDelegate, PSPDFNewPageViewControllerDelegate,
PSPDFNewPageViewControllerDataSource, PSPDFSaveViewControllerDelegate,
PSPDFOverridable>
Swift
class PDFDocumentEditorToolbarController : FlexibleToolbarController, PDFDocumentEditorDelegate, PDFNewPageViewControllerDelegate, PDFNewPageViewControllerDataSource, SaveViewControllerDelegate, Overridable
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.-
Initialize with a document editor toolbar.
Declaration
Objective-C
- (nonnull instancetype)initWithDocumentEditorToolbar: (nonnull PSPDFDocumentEditorToolbar *)documentEditorToolbar;
Swift
init(documentEditorToolbar: PDFDocumentEditorToolbar)
-
Displayed document editor toolbar.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFDocumentEditorToolbar *_Nonnull documentEditorToolbar;
Swift
var documentEditorToolbar: PDFDocumentEditorToolbar { get }
-
The document editor on which the toolbar actions are performed.
Declaration
Objective-C
@property (nonatomic, nullable) PSPDFDocumentEditor *documentEditor;
Swift
var documentEditor: PDFDocumentEditor? { get set }
-
The page indexes of the pages that should be affected by actions that require page selection. Should be set to an empty set when there are no selected items.
Declaration
Objective-C
@property (nonatomic, copy) NSIndexSet *_Nonnull selectedPages;
Swift
var selectedPages: IndexSet { get set }
-
Forwards actions from internal handlers.
Declaration
Objective-C
@property (nonatomic, weak) id<PSPDFDocumentEditorToolbarControllerDelegate> _Nullable delegate;
Swift
weak var delegate: PDFDocumentEditorToolbarControllerDelegate? { get set }
-
Used for modal presentation, class overrides, etc.
Declaration
Objective-C
@property (nonatomic, weak) id<PSPDFPresentationContext> _Nullable presentationContext;
Swift
weak var presentationContext: PresentationContext? { get set }
-
Configuration object with various controller options.
Declaration
Objective-C
@property (nonatomic, readonly) PSPDFDocumentEditorConfiguration *_Nonnull documentEditorConfiguration;
Swift
var documentEditorConfiguration: PDFDocumentEditor.Configuration { get }
-
Copies the selected pages into a private named UIPasteBoard on the document editor. Uses
-[PSPDFDocumentEditor exportPages:toPath:withCompletionBlock:]
internally.Declaration
Objective-C
- (void)copySelectedPagesToPasteboard;
Swift
func copySelectedPagesToPasteboard()
-
If pages are available on the internal pasteboard, this pastes them into the document. The new pages are inserted after the last selected page or at the end of the document, if no pages are currently selected. Uses
-[PSPDFDocumentEditor importPagesTo:fromDocument:withCompletionBlock:queue:]
internally. -
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<PSPDFPresentationOption, id> *)options;
Swift
func toggleNewPageController(_ sender: Any?, presentationOptions options: [PresentationOption : Any]? = nil) -> PDFNewPageViewController?
Parameters
sender
A
UIView
orUIBarButtonItem
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
.See
Declaration
Objective-C
- (nullable UIViewController *) toggleSavingConfirmationViewController:(nullable id)sender presentationOptions: (nullable NSDictionary<PSPDFPresentationOption, id> *)options completionHandler: (nullable void (^)(BOOL))completionHandler;
Swift
func toggleSavingConfirmationViewController(_ sender: Any?, presentationOptions options: [PresentationOption : Any]? = nil, completionHandler: ((Bool) -> Void)? = nil) -> UIViewController?
Parameters
sender
A
UIView
orUIBarButtonItem
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<PSPDFPresentationOption, id> *)options completionHandler:(nullable void (^)(BOOL))completionHandler;
Swift
func toggleSave(_ sender: Any?, presentationOptions options: [PresentationOption : Any]? = nil, completionHandler: ((Bool) -> Void)? = nil) -> SaveViewController?
Parameters
sender
A
UIView
orUIBarButtonItem
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 callingsuper
.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
orUIBarButtonItem
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.