How can I disable zooming on PDFView?
I've already tried the solution here, but it didn't work. I can still zoom in and zoom out.
Here's my PDFView:
let pdfView: PDFView = {
let pdfView = PDFVIew()
let urlPath = Bundle.main.path(forResource: "PdfFile", ofType: "pdf")
let url = URL(fileURLWithPath: urlPath!)
pdfView.document = PDFDocument(url: url)
pdfView.autoScales = true
pdfView.displayMode = .singlePageContinuous
pdfView.displayDirection = .vertical
pdfView.pageShadowsEnabled = false
return pdfView
}()
Add following line of code will disable zoom of PDFView
.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
pdfView.minScaleFactor = pdfView.scaleFactor
pdfView.maxScaleFactor = pdfView.scaleFactor
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With