PSPDFPresentationActions

Objective-C

@protocol PSPDFPresentationActions <NSObject>

Swift

protocol PresentationActions : NSObjectProtocol

Methods to present/dismiss view controllers. UIViewController doesn’t expose enough to conveniently present/dismiss controllers, so this protocol extends it.

  • Presents a view controller using the specified options.

    Note

    If the presentation is blocked (e.g. return NO on the shouldShow delegate), the completion block will not be called.

    Warning

    The presented view controller’s presentationController and popoverPresentationController should not be accessed before calling this method, because the presentation style or transitioning delegate may change. If you need to configure the popover presentation, set values in the options with keys PSPDFPresentationOptionSourceRectProvider, PSPDFPresentationOptionPopoverArrowDirections, and PSPDFPresentationOptionPopoverPassthroughViews.

    Declaration

    Objective-C

    - (BOOL)presentViewController:(nonnull UIViewController *)viewController
                          options:
                              (nullable NSDictionary<PSPDFPresentationOption, id> *)
                                  options
                         animated:(BOOL)animated
                           sender:(nullable id)sender
                       completion:(nullable void (^)(void))completion;

    Swift

    func present(_ viewController: UIViewController, options: [PresentationOption : Any]? = nil, animated: Bool, sender: Any?, completion: (() -> Void)? = nil) -> Bool
  • Dismisses a view controller of class controllerClass that was previously presented with presentViewController:options:animated:sender:completion:. If controllerClass is nil then view controllers of any class may be dismissed.

    Declaration

    Objective-C

    - (BOOL)dismissViewControllerOfClass:(nullable Class)controllerClass
                                animated:(BOOL)animated
                              completion:(nullable void (^)(void))completion;

    Swift

    func dismissViewController(of controllerClass: AnyClass?, animated: Bool, completion: (() -> Void)? = nil) -> Bool