Disabling automatic opening of comments

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

0:00
0:00

To prevent the note annotations from opening the comments automatically, implement the pdfViewController(\_:<wbr>didTapOn:<wbr>annotationPoint:<wbr>annotationView:<wbr>pageView:<wbr>viewPoint:) delegate method and use select(annotations:<wbr>presentMenu:<wbr>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 customization from above in place, tapping a note annotation will bring up the annotation selection menu instead, which will require tapping on the Comments menu item to bring up the NoteAnnotationViewController again.

0:00
0:00

Refer to our handling user interactions guide to learn more about customizing different aspects of how your users interact with annotations.