我想问一些对我很重要的事情
我制作了一个包含按钮的应用程序 这些按钮具有PDF文件
但是当我点击应用程序中的PDF文件时,我有几个选项QuickView , Print , Create PDF
如此图片
但是,当我点击在Create PDF
中自动打开的PDF文件时,我可以吗?
就像你在图片PDFAnnotation
我知道如何在swift中打开PDF文件,但我想在Create PDF
import UIKit
class ViewController: UIViewController {
lazy var document: UIDocumentInteractionController = {
let url = Bundle.main.url(forResource: "Steve", withExtension: "pdf")
let vc = UIDocumentInteractionController(url: url!)
vc.delegate = self
return vc
}()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = UIColor.cyan
}
@IBAction func doAction1(_ sender: AnyObject) {
document.presentOptionsMenu(from: view.bounds, in: view, animated: true)
}
@IBAction func doAction2(_ sender: AnyObject) {
document.presentOptionsMenu(from: view.bounds, in: view, animated: true)
}
@IBAction func doAction3(_ sender: AnyObject) {
document.presentOptionsMenu(from: view.bounds, in: view, animated: true)
}
}
extension ViewController: UIDocumentInteractionControllerDelegate {
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
}