Add a tap gesture recognizer to PDFView in iOS 13

yso*_*ng4 5 uitapgesturerecognizer ios-pdfkit ios13

My code works in iOS 12. But after upgrading to iOS 13, it does not work.

let pinPointRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.pinPoint(sender:)))
pinPointRecognizer.numberOfTapsRequired = 1
self.pdfView.addGestureRecognizer(pinPointRecognizer)
Run Code Online (Sandbox Code Playgroud)

I have tried adding the pinPointRecognizer.numberOfTouchesRequired = 2 and it can trigger pinPoint() function. But I want to trigger pinPoint() in a single tap.

Is this behaviour a bug that will be fixed in the future iOS version? Is there a workaround to fix this?

Thanks!

Updated:

Thank you all for your reply! I am sorry that I may not have the time to test all your answers. I have changed my app's behaviour to work around the problem.

I need to pin a point on PDF file. My workaround is to add an additional layer, which display a pin icon on the center of the PDFView. When a user tap on the PDF view, I will add one pin icon image annotation on the PDFView.

In a word, in my workaround, I still use the tap gesture recognizer. But the recognizer only pin a point on the center of current PDFView. User can zoom in/out and drag around to control where to pin the point.

小智 0

该错误似乎在 iOS 13.2 版本上得到了解决。不幸的是我找不到解决这个问题的方法。