【发布时间】:2020-02-04 17:20:08
【问题描述】:
我被分配了一项任务,我应该在其中绘制一些图像和这些图像之间的一些直线。我用这个方法成功了,
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 上运行良好。任何可能的解决方案?
【问题讨论】:
标签: swift pdf annotations ios13 ios-pdfkit