PTTextSelectTool


@interface PTTextSelectTool : PTTool

Tool for selecting text.

  • The starting point of where to start a selection, defined by the user’s finger’s location when dragging a selection bar.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGPoint selectionStart;

    Swift

    var selectionStart: CGPoint { get }
  • The starting point of where to end a selection, defined by the user’s finger’s location when dragging a selection bar.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGPoint selectionEnd;

    Swift

    var selectionEnd: CGPoint { get }
  • The starting point of the selected text, where the self.leadingBar is.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGPoint selectionStartCorner;

    Swift

    var selectionStartCorner: CGPoint { get }
  • The starting point of the selected text, where the self.trailingBar is.

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGPoint selectionEndCorner;

    Swift

    var selectionEndCorner: CGPoint { get }
  • The first page of the selection

    Declaration

    Objective-C

    @property (nonatomic, readonly) int selectionStartPageNumber;

    Swift

    var selectionStartPageNumber: Int32 { get }
  • The last page of the selection

    Declaration

    Objective-C

    @property (nonatomic, readonly) int selectionEndPageNumber;

    Swift

    var selectionEndPageNumber: Int32 { get }
  • YES if there is a text selection visible on the screen.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL selectionOnScreen;

    Swift

    var selectionOnScreen: Bool { get }
  • An array of CALayer* objects that are used for highlighting selected text.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<__kindof CALayer *> *_Nonnull selectionLayers;

    Swift

    var selectionLayers: [CALayer] { get }
  • The leading selection bar.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) PTSelectionBar *leadingBar;

    Swift

    var leadingBar: PTSelectionBar? { get }
  • The trailing selection bar.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) PTSelectionBar *trailingBar;

    Swift

    var trailingBar: PTSelectionBar? { get }
  • Visually selects the text.

    Declaration

    Objective-C

    - (void)DrawSelectionQuads:(nonnull NSArray<NSValue *> *)quads
                     WithLines:(BOOL)lines
             WithDropAnimation:(BOOL)animation;

    Swift

    func drawSelectionQuads(_ quads: [NSValue], withLines lines: Bool, withDropAnimation animation: Bool)

    Parameters

    quads

    An array of CGRects (wrapped in NSValue) representing where to visually select. Screen (PTPDFViewCtrl) coordinates.

    lines

    Set to YES if selection should have resize handles.

  • Uses the current selection and default annotaiton properties to create a new text markup annotation.

    Declaration

    Objective-C

    - (void)createTextMarkupAnnot:(PTExtendedAnnotType)annotType;

    Swift

    func createTextMarkupAnnot(_ annotType: PTExtendedAnnotType)

    Parameters

    annotType

    The type of text markup annotation.

  • Uses the current selection to create a new text markup annotation.

    Declaration

    Objective-C

    - (void)createTextMarkupAnnot:(PTExtendedAnnotType)annotType
                        withColor:(nonnull PTColorPt *)color
                   withComponents:(int)components
                      withOpacity:(double)opacity;

    Swift

    func createTextMarkupAnnot(_ annotType: PTExtendedAnnotType, withColor color: PTColorPt, withComponents components: Int32, withOpacity opacity: Double)

    Parameters

    annotType

    The type of text markup annotation.

    color

    The color of the annotation

    components

    The number of components of the new color.

    opacity

    The opacity of the new annotation, where 0. is fully transparent, and 1. is fully opaque.

  • Selects text using the properties selectionStart and selectionEnd points.

    Note

    Note that this is a conceptual selection - to visually select it, the returned array must be pased to DrawSelectionQuads:WithLines.

    Declaration

    Objective-C

    - (nonnull NSArray<NSValue *> *)MakeSelection;

    Swift

    func makeSelection() -> [NSValue]

    Return Value

    An array of NSValue wrapped CGRects, representing the selected text.

  • Clears the selection bars and conceptual selection.

    Declaration

    Objective-C

    - (void)ClearSelectionBars;

    Swift

    func clearSelectionBars()
  • Clears the visual selection.

    Declaration

    Objective-C

    - (void)ClearSelectionOnly;

    Swift

    func clearSelectionOnly()
  • Show the shared UIMenuController with options relevant for the selection.

    Declaration

    Objective-C

    - (void)ShowMenuController;

    Swift

    func showMenuController()
  • Retrieves the quads of the current selection for visual display via DrawSelectionQuads:withLines:.

    Declaration

    Objective-C

    - (nullable NSArray<NSValue *> *)GetQuadsFromPage:(int)page1 ToPage:(int)page2;

    Swift

    func getQuadsFromPage(_ page1: Int32, toPage page2: Int32) -> [NSValue]?

    Parameters

    page1

    The first page to retrieve the quads from.

    page2

    The second page to retreive the quads from.

    Return Value

    The selection’s quads.

  • Adds the draggable dots to the selection.

    Declaration

    Objective-C

    - (void)DrawSelectionBars:(nonnull NSArray<NSValue *> *)selection;

    Swift

    func drawSelectionBars(_ selection: [NSValue])

    Parameters

    selection

    The quads of the current selection, as returned by MakeSelection or GetQuadsFromPage:ToPage:.

  • Copies the selected text to the pasteboard.

    Declaration

    Objective-C

    - (void)copyText:(nullable id)sender;

    Swift

    func copyText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Highlights the selected text

    Declaration

    Objective-C

    - (void)highlightText:(nullable id)sender;

    Swift

    func highlightText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Underlines the selected text

    Declaration

    Objective-C

    - (void)underlineText:(nullable id)sender;

    Swift

    func underlineText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Squiggly underlines the selected text

    Declaration

    Objective-C

    - (void)squigglyUnderlineText:(nullable id)sender;

    Swift

    func squigglyUnderlineText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Strikeout the selected text

    Declaration

    Objective-C

    - (void)strikeoutText:(nullable id)sender;

    Swift

    func strikeoutText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Defines the selected text

    Declaration

    Objective-C

    - (void)defineText:(nullable id)sender;

    Swift

    func defineText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.

  • Speaks the selected text (text to speach)

    Declaration

    Objective-C

    - (void)speakText:(nullable id)sender;

    Swift

    func speakText(_ sender: Any?)

    Parameters

    sender

    The object calling this method.