如何找到要在WKWebView中加载的PDF文件

时间:2019-08-14 03:55:18

标签: pdf wkwebview

我正在尝试通过表格视图将多个PDF文件打开到WKwebview中。表格视图似乎已正确设置,但导航出现问题。当我单击单元格时,它会打开WKwebview,但它保持黑色,并且不显示我的PDF文件。我认为查找文件存在问题。

我尝试重命名文件并 允许任意负载

//步骤1         如果让aboutaboutAppPath = Bundle.main.url(forResource:aboutAppPdfName,withExtension:“ pdf”){

    //step2
    let webView = WKWebView(frame: self.view.frame)
        self.view.addSubview(self.view)
        webView.navigationDelegate = self as? WKNavigationDelegate
    let aboutAppPathUrl = aboutAppPath
    let urlRequest = NSURLRequest(url: aboutAppPathUrl)
    webView.load(urlRequest as URLRequest)
    }

    else {
        print(Error.self)

重写func tableView(_ tableView:UITableView,didSelectRowAt indexPath:IndexPath){         aboutAppPdfName = aboutAppPdfTitles [indexPath.row]         performSegue(withIdentifier:“ aboutAppSegue”,发送者:nil)

0 个答案:

没有答案
相关问题