قالب وردپرس درنا توس
Home / IOS Development / ios – Swift 4 – PDF annotation text (or UITextField) to be the size of the text

ios – Swift 4 – PDF annotation text (or UITextField) to be the size of the text



I've made a PDFAnnotation Text Widget, and everything works fine, multiline, so what I'm trying to do, sets the size of this note to the size of text … is it sensible? How would I do that?

Here is my note:

  let page = pdfView.currentPage

textAnnotation = PDFAnnotation (limits: CGRect (x: 300, y: 200, width: 600, height: 100), forType: PDFAnnotationSubtype (rawValue: PDFAnnotationSubtype.widget.rawValue), withProperties: nil)

textAnnotation.widgetFieldType = PDFAnnotationWidgetSubtype (rawValue: PDFAnnotationWidgetSubtype.text.rawValue)

textAnnotation.font = UIFont.systemFont (ofSize: 80)

textAnnotation.fontColor = .red

textAnnotation.isMultiline = true

textAnnotation.widgetStringValue = "Text here"

page! .addAnnotation (textAnnotation)

How do I make the size of the text as the original tool? Or how I make this a UITextField because I can probably do more or less the same.


Source link