Luca
Luca

Reputation: 55

Add subviews to PDFView

I need to place some UILabel as subviews of a PDFView, this labels should be placed on specific pages of the PDFView and should scroll with the document.

How can I achieve this? I looked for a reference of scrollview in PDFView class but I don't find it.

Upvotes: 1

Views: 568

Answers (1)

you can create a class PDFT and inherit PDFView override method drawPagePost

public class PDFT : PDFView {
     public override func drawPagePost(_ page: PDFPage, to context: CGContext) {
    // add subview in here
    let subview = UIView()
    self.documentView?.addSubview(subview)
    }
}

Upvotes: 0

Related Questions