【发布时间】:2021-01-27 18:54:07
【问题描述】:
通过使用下面的代码,我可以加载 pdf。然后我在导航栏添加了一个添加签名按钮。单击添加签名按钮应该允许我浏览签名图像,然后单击添加按钮后它应该在 pdf 上添加签名并返回到第一个视图控制器。
或在第一个视图控制器中,当 pdf 显示如何绘制签名时
import UIKit
import PDFKit
class ViewController: UIViewController { @IBOutlet weak var pdfContainerView: PDFView!
override func viewDidLoad() {
super.viewDidLoad()
self.title = "PDF Viewer"
setupPdfView()
}
func setupPdfView() {
if let path = Bundle.main.path(forResource: "sample", ofType: "pdf") {
if let pdfDocument = PDFDocument(url: URL(fileURLWithPath: path)) {
pdfContainerView.displayMode = .singlePageContinuous
pdfContainerView.autoScales = true
pdfContainerView.displayDirection = .vertical
pdfContainerView.document = pdfDocument
}
}
}
}
【问题讨论】:
-
This 可能会有所帮助