在PDFAnnotation中打开我的文件PDF,快速

时间:2018-02-05 15:28:46

标签: ios swift xcode swift4

我想问一些对我很重要的事情

我制作了一个包含按钮的应用程序 这些按钮具有PDF文件

但是当我点击应用程序中的PDF文件时,我有几个选项QuickView , Print , Create PDF

1

如此图片

但是,当我点击在Create PDF中自动打开的PDF文件时,我可以吗?

就像你在图片PDFAnnotation

中看到的那样

2

我知道如何在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
    }

}

0 个答案:

没有答案