在 PDFView 上禁用缩放 (iOS)
Disable zooming on PDFView (iOS)
如何禁用 PDFView 的缩放功能?
我已经尝试过 here 的解决方案,但没有用。我仍然可以放大和缩小。
这是我的 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
}()
添加以下代码行将禁用 PDFView
.
的缩放
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
pdfView.minScaleFactor = pdfView.scaleFactor
pdfView.maxScaleFactor = pdfView.scaleFactor
}
如何禁用 PDFView 的缩放功能?
我已经尝试过 here 的解决方案,但没有用。我仍然可以放大和缩小。
这是我的 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
}()
添加以下代码行将禁用 PDFView
.
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
pdfView.minScaleFactor = pdfView.scaleFactor
pdfView.maxScaleFactor = pdfView.scaleFactor
}