PSPDFNoteAnnotationViewController


@interface PSPDFNoteAnnotationViewController
    : PSPDFBaseViewController <UIGestureRecognizerDelegate, UITextViewDelegate,
                               PSPDFStyleable>

The note annotation controller can be used for any type of annotation (showing contents) For PSPDFNoteAnnotation object types, additional options are displayed.

  • Convenience initializer to initialize with an annotation. - note: Automatically sets the editable state based on the annotation isEditable property And what is set in document.editableAnnotationTypes.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithAnnotation:
        (nonnull PSPDFAnnotation *)annotation;

    Swift

    init(annotation: PSPDFAnnotation)
  • Attached annotation. All types are allowed.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic, nullable) PSPDFAnnotation *annotation;

    Swift

    var annotation: PSPDFAnnotation? { get set }
  • If NO, the Edit/Delete buttons are not displayed and the text will be readonly. - note: While you could set allowEditing here with a value different than the annotation, it’s not advised to do so as the content won’t be saved. Use annotation.isEditable && [configuration.editableAnnotationTypes containsObject:annotation.typeString] to test for edit capabilities.

    Declaration

    Objective-C

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

    Swift

    var allowEditing: Bool { get set }
  • If YES, the edit button will be displayed to show color/icon editing. Defaults to YES. Will be ignored if allowEditing is NO or annotation type is not PSPDFAnnotationTypeNote.

    Declaration

    Objective-C

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

    Swift

    var showColorAndIconOptions: Bool { get set }
  • Shows the copy button. Disabled by default for space reasons. (and because copying text is easy)

    Declaration

    Objective-C

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

    Swift

    var showCopyButton: Bool { get set }
  • If enabled, we enable the edit mode during controller presentation. by calling beginEditing at the correct timing. Defaults to NO.

    Declaration

    Objective-C

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

    Swift

    var shouldBeginEditModeWhenPresented: Bool { get set }
  • Allow to customize the textView. (If UIAppearance rules are not enough)

    Note

    The text view delegate is wired to the controller and methods can be implemented as needed. Do not call super when implementing UITextViewDelegate methods. Internal logic takes care of that automatically as needed.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UITextView *_Nonnull textView;

    Swift

    var textView: NSTextView { get }
  • Attached delegate.

    Declaration

    Objective-C

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

    Swift

    @IBOutlet weak var delegate: PSPDFNoteAnnotationViewControllerDelegate? { get set }
  • Called when we’re about to show the annotation delete menu.

    Declaration

    Objective-C

    - (void)deleteAnnotation:(nonnull UIBarButtonItem *)barButtonItem;

    Swift

    func deleteAnnotation(_ barButtonItem: Any!)
  • Will delete annotation (note) or clear note text (any other type) without confirmation.

    Declaration

    Objective-C

    - (void)deleteOrClearAnnotationWithoutConfirmation;

    Swift

    func deleteOrClearAnnotationWithoutConfirmation()
  • Returns Delete Note or Remove Note - depending if the annotation is a note annotation or a different type.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull deleteAnnotationActionTitle;

    Swift

    var deleteAnnotationActionTitle: String { get }
  • Sets the text view as first responder and enables editing if allowed. Returns YES on success, false if not editable or first responder couldn’t be set.

    Declaration

    Objective-C

    - (BOOL)beginEditing;

    Swift

    func beginEditing() -> Bool
  • Called as we update the text view. This can be used to update various text view properties like font.

    Note

    An even better way is to use UIAppearance: [[UITextView appearanceWhenContainedIn:PSPDFNoteAnnotationViewController.class, nil] setFont:[UIFont fontWithName:@"Helvetica" size:20.f]];

    Declaration

    Objective-C

    - (void)updateTextView;

    Swift

    func updateTextView()
  • Background gradient view.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView *_Nonnull backgroundView;

    Swift

    var backgroundView: NSView { get }
  • Option view (note annotations)

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView *_Nonnull optionsView;

    Swift

    var optionsView: NSView { get }
  • The border color of items in the option view.

    Declaration

    Objective-C

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

    Swift

    var borderColor: NSColor? { get set }
  • Tap gesture on the textView to enable/disable edit mode.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UITapGestureRecognizer *_Nonnull tapGesture;

    Swift

    var tapGesture: NSPanGestureRecognizer { get }
  • Called initially and every time a property changes to re-build the navigation item’s bar button items.

    Declaration

    Objective-C

    - (void)setupToolbar;

    Swift

    func setupToolbar()
  • Called whenever text is changed and after toolbar creation. Used to control the delete button enabled state.

    Declaration

    Objective-C

    - (void)updateToolbar;

    Swift

    func updateToolbar()