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.

When used in an app extension, a scaled down version of the image is used to avoid exceeding the 120 MB limit of app extensions.

@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) id<PSPDFImagePickerControllerDelegate> _Nullable imageDelegate;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic) 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) 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

    To allow the user to take a photo with the camera, make sure you add NSCameraUsageDescription to your Info.plist. See https://pspdfkit.com/guides/ios/getting-started/permissions/#image-permissions for further documentation.

    Declaration

    Objective-C

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

    Swift

    class func availableImagePickerSourceTypes() -> [NSNumber]