PTAnnotEditTool

@interface PTAnnotEditTool
    : PTTool <UIPopoverPresentationControllerDelegate, UITextViewDelegate,
              PTAnnotStyleViewControllerDelegate>

The PTAnnotEditTool is used to change the properties, position and size of annotations. It also handles link annotations.

  • The transparent parent view that holds the shaded annotation selection rectangle and resize handles.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        PTSelectionRectContainerView *_Nonnull selectionRectContainerView;

    Swift

    var selectionRectContainerView: PTSelectionRectContainerView { get }
  • When the user is resizing the annotation, the resize handle that is currently in use.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView *_Nullable touchedSelectWidget;

    Swift

    weak var touchedSelectWidget: UIView? { get }
  • When true, only corner resize handles are available, and the aspect ratio will be maintained. Default is true for stamp and signatures annotations, false for others.

    Declaration

    Objective-C

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

    Swift

    var maintainAspectRatio: Bool { get set }
  • The minimum size that annotations can be resized to, expressed in page space. The default value is 0.

    Declaration

    Objective-C

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

    Swift

    var minimumAnnotationSize: CGFloat { get set }
  • The maximum size that annotations can be resized to, expressed in page space. By default, there is no maximum size limit.

    Declaration

    Objective-C

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

    Swift

    var maximumAnnotationSize: CGFloat { get set }
  • The PTAnnotEditTool‘s delegate object.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<PTAnnotEditToolDelegate> delegate;

    Swift

    weak var delegate: PTAnnotEditToolDelegate? { get set }
  • Selects the specified annotation.

    Declaration

    Objective-C

    - (BOOL)selectAnnotation:(nonnull PTAnnot *)annotation
                onPageNumber:(unsigned int)pageNumber;

    Swift

    func selectAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt32) -> Bool

    Parameters

    annotation

    the annotation to select

    pageNumber

    the page number of the annotation

    Return Value

    YES if the annotation was selected, NO otherwise.

  • An array of selected annotations.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic)
        NSArray<PTAnnot *> *_Nonnull selectedAnnotations;

    Swift

    var selectedAnnotations: [PTAnnot] { get set }
  • Sets the annotation’s border thickness.

    Declaration

    Objective-C

    - (void)setAnnotationBorder:(float)thickness;

    Swift

    func setAnnotationBorder(_ thickness: Float)
  • Selects the annotation where the user tapped or long pressed. If it is a link, the link will be followed.

    Declaration

    Objective-C

    - (BOOL)makeNewAnnotationSelection:
        (nonnull UIGestureRecognizer *)gestureRecognizer;

    Swift

    func makeNewAnnotationSelection(_ gestureRecognizer: UIGestureRecognizer) -> Bool
  • Deselects the currently selected annotation currentAnnotation.

    Declaration

    Objective-C

    - (void)deselectAnnotation;

    Swift

    func deselectAnnotation()
  • Sets the currentAnnotation‘s opacity.

    Declaration

    Objective-C

    - (void)setAnnotationOpacity:(double)opacity;

    Swift

    func setAnnotationOpacity(_ opacity: Double)
  • Allows the user to set the currentAnnotation‘s stroke color.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationStrokeColor;

    Swift

    func editSelectedAnnotationStrokeColor()
  • Allows the user to set the currentAnnotation‘s border thickness.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationBorder;

    Swift

    func editSelectedAnnotationBorder()
  • Allows the user to set the currentAnnotation‘s opacity.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationOpacity;

    Swift

    func editSelectedAnnotationOpacity()
  • Allows the user to edit the currentAnnotation‘s style.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationStyle;

    Swift

    func editSelectedAnnotationStyle()
  • Commits the user-selected style for the currentAnnotation.

    Declaration

    Objective-C

    - (void)commitSelectedAnnotationStyle;

    Swift

    func commitSelectedAnnotationStyle()
  • Bounds a point in screen space to the current page’s crop box.

    Declaration

    Objective-C

    - (CGPoint)boundPointToPage:(CGPoint)point;

    Swift

    func boundPoint(toPage point: CGPoint) -> CGPoint

    Parameters

    point

    a point in screen space

    Return Value

    a point in screen space, guaranteed to be within the page.

  • Ensures that a rect in page space is within the page it’s on.

    Declaration

    Objective-C

    - (nonnull PTPDFRect *)boundPageRect:(nonnull PTPDFRect *)pageRect
                                  toPage:(int)pageNumber;

    Swift

    func boundPageRect(_ pageRect: PTPDFRect, toPage pageNumber: Int32) -> PTPDFRect

    Parameters

    pageRect

    the rect in page space

    pageNumber

    the page number

    Return Value

    the new rectangle, guaranteed to be within the page.

  • Ensures that a new rect’s position lies within the page it’s on.

    Declaration

    Objective-C

    - (CGRect)boundRectToPage:(CGRect)annotRect isResizing:(BOOL)resizing;

    Swift

    func boundRect(toPage annotRect: CGRect, isResizing resizing: Bool) -> CGRect

    Parameters

    annotRect

    the annotation’s proposed new rectangle.

    resizing

    if the annotation was changed via a resize (as opposed to a move)

    Return Value

    the new rectangle, guaranteed to be within the page.