at the moment I try to implement a PDF view with annotations in my iOS App. I implemented a function for adding note annotations as a text annotation like this:
let rect = CGRect.init(x: lastLongPressLoc.x, y: lastLongPressLoc.y, width: 24, height: 24)
let ann = PDFAnnotation(bounds: rect, forType: PDFAnnotationSubtype.text, withProperties: nil)
ann.font = UIFont(name: "Helvetica", size: 20.0)
ann.interiorColor = UIColor.yellow
ann.popup?.interiorColor = UIColor.yellow
ann.color = UIColor.yellow
ann.iconType = PDFTextAnnotationIconType.comment
self.currentPage?.addAnnotation(ann)
Adding and editing the annotation works quite fine. For deleting and other options I now want to implement some buttons above the keyboard which should appear when the annotation was tapped. For widget annotations I found a great thread, that helped me with this (Configuring keyboard settings within PDFView form fields). The solution recommends to search the active subviews for a UITextView when the annotation gets tapped via the PDFViewAnnotationHit notification and manipulate the inputAccessoryView property. I assume that the editing of popup annotation works a bit different. While editing a text annotation I unfortunately cannot find an UITextView in my app.
Has someone came across this problem or has better insights in the PDFKit framework and can give me a hint?
Thanks for your time!