Disabling Automatic Opening of Comments

By default, tapping on a note annotation in a regular-width trait environment will automatically display the comments associated with that annotation in a popover presentation.

To prevent the note annotations from opening the comments automatically, implement the pdfViewController(_:didTapOn:annotationPoint:annotationView:pageView:viewPoint:) delegate method and use select(annotations:presentMenu:animated:) to programmatically select note annotations:

func pdfViewController(_ pdfController: PDFViewController, didTapOn annotation: Annotation, annotationPoint: CGPoint, annotationView: (UIView & AnnotationPresenting)?, pageView: PDFPageView, viewPoint: CGPoint) -> Bool {
    if annotation is NoteAnnotation {
        pageView.select(annotations: [annotation], presentMenu: true, animated: true)
        return true
    } else {
        return false
    }
}

With the above customization in place, tapping on a note annotation will bring up the annotation selection menu instead, and will require tapping on the Comments menu item to bring up the NoteAnnotationViewController again.

Check out our Handling User Interactions guide to learn more about customizing different aspects of how your users interact with annotations.