iOS 10.3 中的 WKWebview 未完全加载

WKWebview not fully loaded in iOS 10.3

我在 WKWebview 中加载本地 html 文件时遇到问题。 我的程序适用于 iOS 8、9、11,但不适用于 10.3。正文中间只有白色space

我正在这样创建我的 WKWebview:

let webConfiguration = WKWebViewConfiguration();
let frame = CGRect(x: 0, y: 0, width: cell.frame.width, height: self.webViewHeight);
infoWebView = WKWebView(frame: frame, configuration: webConfiguration);
infoWebView.navigationDelegate = self;
infoWebView.translatesAutoresizingMaskIntoConstraints = false
infoWebView.scrollView.isScrollEnabled = false;
infoWebView.clipsToBounds = false;
infoWebView.allowsBackForwardNavigationGestures = false
infoWebView.contentMode = .scaleToFill
infoWebView.sizeToFit()

我的 html 文件的加载是通过以下代码完成的:

if let availableUrl = url {
                let urlRequest = URLRequest(url: availableUrl)
                infoWebView.load(urlRequest)
            }

您知道为什么它适用于 iOS 8、9、11 但不适用于 iOS 10.3 吗? 有人可以重现这个问题吗?

此致问候,祝您有愉快的一天!

因为我的 wkwebview 在 table 视图中,所以我不得不从 UITableViewDelegate 覆盖 scrollViewDidScroll。

中的这段代码对我有用:

// in the UITableViewDelegate
func scrollViewDidScroll(scrollView: UIScrollView) {
    if let tableView = scrollView as? UITableView {
        for cell in tableView.visibleCells {
            guard let cell = cell as? MyCustomCellClass else { continue }
            cell.webView?.setNeedsLayout()
        }
    }
}