Disable zooming on PDFView (iOS)

跟風遠走 提交于 2019-12-07 07:23:46

问题


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
}()

回答1:


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
}


来源:https://stackoverflow.com/questions/57826689/disable-zooming-on-pdfview-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!