PSPDFTextSelectionViewDelegate
Objective-C
@protocol PSPDFTextSelectionViewDelegate <NSObject>
Swift
protocol TextSelectionViewDelegate : NSObjectProtocol
Delegate for PSPDFTextSelectionView
.
-
Called whenever there’s a good moment to show/hide the menu based on the selection state of
selectedGlyphs
orselectedImage
.Declaration
Objective-C
- (BOOL)textSelectionView:(nonnull PSPDFTextSelectionView *)textSelectionView updateMenuAnimated:(BOOL)animated;
Swift
func textSelectionView(_ textSelectionView: TextSelectionView, updateMenuAnimated animated: Bool) -> Bool
-
Called when text is about to be selected. Return NO to disable text selection.
Declaration
Objective-C
- (BOOL)textSelectionView:(nonnull PSPDFTextSelectionView *)textSelectionView shouldSelectText:(nonnull NSString *)text withGlyphs:(nonnull NSArray<PSPDFGlyph *> *)glyphs atRect:(CGRect)rect;
Swift
optional func textSelectionView(_ textSelectionView: TextSelectionView, shouldSelectText text: String, with glyphs: [PSPDFGlyph], at rect: CGRect) -> Bool
-
Called after text has been selected. Will also be called when text has been deselected. Deselection sometimes cannot be stopped, so the
shouldSelectText:
will be skipped.Declaration
Objective-C
- (void)textSelectionView:(nonnull PSPDFTextSelectionView *)textSelectionView didSelectText:(nonnull NSString *)text withGlyphs:(nonnull NSArray<PSPDFGlyph *> *)glyphs atRect:(CGRect)rect;
Swift
optional func textSelectionView(_ textSelectionView: TextSelectionView, didSelectText text: String, with glyphs: [PSPDFGlyph], at rect: CGRect)