PKDocumentViewer 0.1.3

PKDocumentViewer 0.1.3

Pawan Kumar 维护。



  • Pawan Kumar iOS 开发者

PKDocumentViewer

Version License Platform codebeat badge

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

要求

  • iOS 13.0+
  • Xcode 11.0+

安装

PKDocumentViewer 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'PKDocumentViewer'

设置示例代码

//implement UIDocumentInteractionControllerDelegate
class ViewController: UIViewController,UIDocumentInteractionControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Setup delegates
          PKDocumentViewer.shared.setUpDelegates(self)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    @IBAction func viewPDFButtonTapped(_ sender: Any) {
        // Call to view pdf
               PKDocumentViewer.shared.viewPdf(urlPath: "http://www.pdf995.com/samples/pdf.pdf", screenTitle: "Tesing Document")
    }
    
    // when a document interaction controller needs a view controller for presenting a document preview.
      
    // use this fuction for preview
       func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
          return self.navigationController ?? UIViewController()
      }
}

使用方法

preview

作者

Pawan Kumar iOS开发者,[email protected]https://pawankumar.cf/

许可证

PKDocumentViewer遵循MIT许可证。请参阅LICENSE文件以获取更多信息。