我想在我的应用程序中使用PDFAnnotationWidgetSubtype签名。但它没有按预期工作。我想用Apple Pencil签名。但是下面的代码只是制作了一个给定尺寸的盒子。没有检测到铅笔/手触摸。
这是我的代码:
func addSignature() {
let bounds = CGRect(x: 100, y: 100, width: 300, height: 50)
let annotation = PDFAnnotation(bounds: bounds, forType: PDFAnnotationSubtype.widget, withProperties: nil)
annotation.backgroundColor = UIColor.blue
annotation.color = UIColor.darkGray
annotation.fieldName = "signature"
annotation.widgetFieldType = .signature
annotation.shouldDisplay = true
annotation.shouldPrint = true
annotation.widgetControlType = .unknownControl
let border = PDFBorder()
border.lineWidth = 2.0
annotation.border = border
print("Appareance Stream \(annotation.hasAppearanceStream)")
pdfView.document?.page(at: 0)?.addAnnotation(annotation)
}
任何帮助都将不胜感激。