简体   繁体   中英

iOS Swift PDFKit Widget Subtype button border

I'm working with PDFKit, and I'm looking to add a PDF Annotation that supports the user selecting/deselecting it. I'm using PDFAnnotationWidgetSubtype.button and I can't find a way to remove the border. I've tried subclassing PDFBorder to no avail, has anyone else has experience with this?

带有边框的复选框

ANSWER

My solution to this problem was to create my own PDFAnnotation subclass.

var isChecked = false

init(forBounds bounds: CGRect, withProperties properties: [AnyHashable : Any]?)

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

I used the isChecked property inside of the draw function. If the property was toggled on, then I was display a checkmark image I found on Icons8. I also had to add the PDFAnnotationHitObserver in my ViewController, and handled updating the property of isChecked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM