PSPDFResizableView


@interface PSPDFResizableView : UIView

A view that shows borders around selected annotations, with handles the user can use to resize the annotation. The handle and border color is determined by the tintColor property inherited from UIView.

  • Delegate called on frame change. Users can set this property to get callbacks.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<PSPDFResizableViewDelegate> _Nullable delegate;

    Swift

    @IBOutlet weak var delegate: PSPDFResizableViewDelegate? { get set }
  • The mode that the resizable view is currently in.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) PSPDFResizableViewMode mode;

    Swift

    var mode: PSPDFResizableViewMode { get set }
  • View that will be changed on selection change.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSSet<UIView *> *trackedViews;

    Swift

    var trackedViews: Set<UIView>? { get set }
  • The annotations corresponding to the trackedViews — cached.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        NSSet<PSPDFAnnotation *> *_Nonnull trackedAnnotations;

    Swift

    var trackedAnnotations: Set<AnyHashable> { get }
  • Set zoom scale to be able to draw the page knobs at the correct size.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat zoomScale;

    Swift

    var zoomScale: CGFloat { get set }
  • The insets of the selection border and resize knobs from the tracked annotation view. Since padding is usually desirable, the values of these insets should usually be negative. Defaults to -20.0 for top, bottom, right, and left.

    These insets will be combined with outerEdgeInsets to map between the content size and center and the resizable view bounds and center.

    Note

    updateAnnotationSelectionView in PSPDFPageView is used to set the inner edge insets of non-resizable annotations (e.g. note annotations) to -2 for top, bottom, right, and left (ignoring the innerEdgeInsets property). If you want to change this, you need to subclass PSPDFPageView and override updateAnnotationSelectionView.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets innerEdgeInsets;

    Swift

    var innerEdgeInsets: UIEdgeInsets { get set }
  • The insets of the resizable view bounds from the selection border and resize knobs. Subviews usually lie within the bounds of their superview, so the values of these insets should usually be negative. Defaults to -40.0 for top, bottom, right, and left.

    These insets will be combined with innerEdgeInsets to map between the content size and center and the resizable view bounds and center.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets outerEdgeInsets;

    Swift

    var outerEdgeInsets: UIEdgeInsets { get set }
  • If set to NO, won’t show selection knobs and dragging. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL allowEditing;

    Swift

    var allowEditing: Bool { get set }
  • Allows view resizing, shows resize knobs. If set to NO, view can only be moved or adjusted, no resize knobs will be displayed. Depends on allowEditing. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL allowResizing;

    Swift

    var allowResizing: Bool { get set }
  • Allows view adjusting, shows knobs to move single points. If set to NO, view can only be moved or resized, no adjust knobs will be displayed. Depends on allowEditing. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL allowAdjusting;

    Swift

    var allowAdjusting: Bool { get set }
  • Whether to allow rotatable annotations to be rotated. Defaults to YES. Being able to rotate also depends on allowEditing.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL allowRotating;

    Swift

    var allowRotating: Bool { get set }
  • Enables resizing helper so that aspect ratio can be preserved easily. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL enableResizingGuides;

    Swift

    var enableResizingGuides: Bool { get set }
  • Shows the bounding box. Defaults to YES.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL showBoundingBox;

    Swift

    var showBoundingBox: Bool { get set }
  • Defines how aggressively the guide works. Defaults to 20.0. Set to PSPDFGuideSnapAllowanceAlways if you want to always snap to guides.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat guideSnapAllowance;

    Swift

    var guideSnapAllowance: CGFloat { get set }
  • Override the minimum allowed width. This value is ignored if the view is smaller to begin with or the annotation specifies a bigger minimum width. Default is 0..

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat minWidth;

    Swift

    var minWidth: CGFloat { get set }
  • Override the minimum allowed height. This value is ignored if the view is smaller to begin with or the annotation specifies a bigger minimum height. Default is 0..

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat minHeight;

    Swift

    var minHeight: CGFloat { get set }
  • Border size. Defaults to 1.0.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat selectionBorderWidth;

    Swift

    var selectionBorderWidth: CGFloat { get set }
  • Guide color. Defaults to UIColor.pspdf_guideColor.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) UIColor *guideBorderColor;

    Swift

    var guideBorderColor: UIColor? { get set }
  • Corner radius size. Defaults to 2.0.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGFloat cornerRadius;

    Swift

    var cornerRadius: CGFloat { get set }
  • The knob for rotating annotations that are rotatable. This will be hidden if the annotation does not support rotation or allowRotating is disabled.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView<PSPDFKnobView> *_Nonnull rotationKnob;

    Swift

    var rotationKnob: UIView & PSPDFKnobView { get }
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)longPress:(UILongPressGestureRecognizer *)recognizer;

    Swift

    func longPress(_ recognizer: UILongPressGestureRecognizer) -> Bool
  • All knobs. Can be hidden individually. Note that properties like allowEditing/allowResizing will update the hidden property. To properly hide a knob, remove it from the superview.

    Declaration

    Objective-C

    - (nullable UIView<PSPDFKnobView> *)outerKnobOfType:
        (PSPDFResizableViewOuterKnob)knobType;

    Swift

    func outerKnob(ofType knobType: PSPDFResizableViewOuterKnob) -> (UIView & PSPDFKnobView)?
  • Returns the position for a resizing knob. May be overriden to customize the position.

    Declaration

    Objective-C

    - (CGPoint)centerPointForOuterKnob:(PSPDFResizableViewOuterKnob)knobType
                               inFrame:(CGRect)frame;

    Swift

    func centerPoint(for knobType: PSPDFResizableViewOuterKnob, inFrame frame: CGRect) -> CGPoint

    Parameters

    knobType

    The knob whose center position should be calculated.

    frame

    The frame in which the knob is positioned. Usually this is self.bounds, but during resizing, this might be different.

    Return Value

    The center point of where the knob view should be placed.

  • Returns the center point of where rotationKnob should be placed. May be overriden to customize the position.

    Declaration

    Objective-C

    - (CGPoint)centerPointForRotationKnobInFrame:(CGRect)frame;

    Swift

    func centerPointForRotationKnob(inFrame frame: CGRect) -> CGPoint

    Parameters

    frame

    The frame in which the knob is positioned. Usually this is self.bounds, but during resizing, this might be different.

    Return Value

    The center point of where rotationKnob should be placed.

  • Creates and configures a new knob view.

    Declaration

    Objective-C

    - (nonnull UIView<PSPDFKnobView> *)newKnobViewForType:(PSPDFKnobType)type;

    Swift

    func newKnobView(for type: PSPDFKnobType) -> UIView & PSPDFKnobView
  • Update the knobs.

    Declaration

    Objective-C

    - (void)updateKnobsAnimated:(BOOL)animated;

    Swift

    func updateKnobs(animated: Bool)