我被分配了一个任务,我应该在这些图像之间绘制一些图像和一些直线。我用这个方法成功地做到了,
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)
}
}
现在,每当用户点击 PDF 页面时,我只需在该位置添加此图像注释。在 iOS 13 发布后,每当我点击 PDF 页面时,都不会显示图像注释,尽管我收到了触摸代表并且我的代码在 iOS 12 上运行良好。任何可能的解决方案?