3

I have been assigned a task in which I was supposed to draw some images and some straight lines in between those images. I did it successfully by using this method,

    class PDFImageAnnotation: PDFAnnotation {

    var image: UIImage?

    convenience init(_ image: UIImage?, bounds: CGRect, properties: [AnyHashable : Any]?) {
        self.init(bounds: bounds, forType: PDFAnnotationSubtype.ink, withProperties: properties)
        self.image = image
    }

    override func draw(with box: PDFDisplayBox, in context: CGContext) {
        super.draw(with: box, in: context)

        // Drawing the image within the annotation's bounds.
        guard let cgImage = image?.cgImage else { return }
        context.draw(cgImage, in: bounds)
    }
}

Now, whenever user taps on PDF page, I just add this image annotation at that location. After release of iOS 13 whenever I am tapping on PDF page, this is not showing image annotation, although I receive the touch delegates and my code is working fine on iOS 12. Any possible solution?

Najam
  • 1,129
  • 11
  • 32

1 Answers1

0

I faced similar issue, tap gestures were not adding on the PDFView. It is might be because of stacking of views, I am not sure. But I solved it by adding another UIView on top of my PDFView and adding tap-gesture on it.