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 (nonatomic, strong, readonly) 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 (nonatomic, weak, readonly) 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 (nonatomic, assign, unsafe_unretained, readwrite) BOOL maintainAspectRatio;
Swift
var maintainAspectRatio: Bool { get set }
-
When enabled, a visual guide is shown while resizing an annotation to indicate the line along which the annotation’s original aspect ratio is maintained.
This property is enabled by default.
Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isAspectRatioGuideEnabled) BOOL aspectRatioGuideEnabled;
Swift
var isAspectRatioGuideEnabled: 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 (nonatomic, assign, unsafe_unretained, readwrite) 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 (nonatomic, assign, unsafe_unretained, readwrite) CGFloat maximumAnnotationSize;
Swift
var maximumAnnotationSize: CGFloat { get set }
-
The
PTAnnotEditTool
‘s delegate object.Declaration
Objective-C
@property (nonatomic, weak, readwrite, 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. -
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()
-
Edits the currently selected
PTFreeText
annotation’s contents.Declaration
Objective-C
- (void)editSelectedAnnotationFreeText;
Swift
func editSelectedAnnotationFreeText()
-
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
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.
-
The frame for editing the currently selected free text annotation, in the
selectionRectContainerView
‘s local coordinate system.Declaration
Objective-C
- (CGRect)frameForEditingFreeTextAnnotation;
Swift
func frameForEditingFreeTextAnnotation() -> CGRect