PSPDFImagePickerController

Objective-C


@interface PSPDFImagePickerController
    : UIImagePickerController <PSPDFOverridable>

Swift

class ImagePickerController : UIImagePickerController, Overridable

Subclass of UIImagePickerController used in PSPDFKit when showing the image picker, like when adding an image annotation or when adding a new page to a document from an image.

Allows subclassing the image picker controller, for example if you need to block portrait: https://stackoverflow.com/questions/11467361/taking-a-photo-in-an-ios-landscape-only-app

Shows a custom image editor after an image has been selected if shouldShowImageEditor is enabled.

@note delegate is set to self. Don’t change this, as this will restrict presenting the image editor. imageDelegate will be set when the picker is called from within PSPDFKit logic. You can override the delegate as long as you correctly forward calls to the original target.

  • Set this, to be informed about the selected and, if shouldShowImageEditor is enabled, the edited image. Ensure to relay calls to the existing delegate, if one is set.

    Declaration

    Objective-C

    @property (nonatomic, weak, readwrite)
        id<PSPDFImagePickerControllerDelegate> _Nullable imageDelegate;

    Swift

    weak var imageDelegate: ImagePickerControllerDelegate? { get set }
  • Controls showing the image editor after image selection. Defaults to YES.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        BOOL shouldShowImageEditor;

    Swift

    var shouldShowImageEditor: Bool { get set }
  • The offered image qualities.

    Defaults to PSPDFImageQualityAll.

    If there is only one option set or the image is not large enough to offer scaling, no quality sheet will be displayed. You can use PSPDFImageQualityBest, to disable the picker and automatically select the best possible image quality.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        PSPDFImageQuality allowedImageQualities;

    Swift

    var allowedImageQualities: ImagePickerController.ImageQuality { get set }
  • Unavailable

    Do not set the delegate, the object requires the delegate to be set to self

    Undocumented

    Declaration

    Objective-C

    - (void)setDelegate:(nullable id <UINavigationControllerDelegate, UIImagePickerControllerDelegate>)delegate PSPDF_UNAVAILABLE("Do not set the delegate, the object requires the delegate to be set to self");
  • The available image picker source types.

    Then return value should only contain boxed values of UIImagePickerControllerSourceType, valid options are UIImagePickerControllerSourceTypePhotoLibrary and UIImagePickerControllerSourceTypeCamera. Defaults to @[@(UIImagePickerControllerSourceTypePhotoLibrary), @(UIImagePickerControllerSourceTypeCamera)].

    Note

    Make sure you configured Image Permissions in your app for the specified source type. Otherwise, they will be ignored. See https://pspdfkit.com/guides/ios/current/getting-started/permissions/#toc_image-permissions for further documentation.

    Declaration

    Objective-C

    + (nonnull NSArray<NSNumber *> *)availableImagePickerSourceTypes;

    Swift

    class func availableImagePickerSourceTypes() -> [NSNumber]