WKWebView not rendering correctly in iOS 10

后端 未结 5 759
攒了一身酷
攒了一身酷 2020-12-15 03:45

I have WKWebView inside the UITableViewCell. The web view load request and then after finished loading, I\'ll resize the web view height to be equal to its content height, t

5条回答
  •  醉酒成梦
    2020-12-15 04:27

    You need to force the WKWebView to layout while your UITableView scrolls.

    // 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()
            }
        }
    }
    

提交回复
热议问题