0

Anyone Work on PDFKit, I draw a custom Annotation in PDFView, But I want to add action in Custom Annotation and I can't able to add Gesture in PDFAnnotation because it does not inherit from UIView, so is there any way to add Gesture in PDFAnnotation. See the custom Annotation in this image.enter image description here

Iva
  • 2,447
  • 1
  • 18
  • 28
  • Does this answer your question? [how to add GestureRecognizer for PDFAnnotation ios swift 4](https://stackoverflow.com/questions/48743372/how-to-add-gesturerecognizer-for-pdfannotation-ios-swift-4) – Ely Jul 19 '22 at 09:58
  • I Used that code this way – kuldeep bhandari Jul 19 '22 at 17:22
  • @objc func titleTapped(_ gestureRecognizer: UITapGestureRecognizer) { let tapLocation = gestureRecognizer.location(in: pdfViewObj) let tappedPage = pdfView.page(for: tapLocation, nearest: false) if let page = tappedPage { let tapPageLocation = pdfView.convert(tapLocation, to: page) let annotation = page.annotation(at: tapPageLocation) print("anotation : \(annotation)") } } – kuldeep bhandari Jul 19 '22 at 17:23
  • but my code is crashing while we tap on Outside of any annotations. at this line. let tapLocation = gestureRecognizer.location(in: pdfViewObj) – kuldeep bhandari Jul 19 '22 at 17:24
  • and error is Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteNotification locationInView:]: unrecognized selector sent to instance 0x6000006a0fc0' – kuldeep bhandari Jul 19 '22 at 17:25

0 Answers0