WKWebView not rendering correctly in iOS 10

后端 未结 5 756
攒了一身酷
攒了一身酷 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:12

    Im also have uitableview with cell with wkWebView. And i stack with same problem. But timely you can fix this with this code. By performance do not worry. I tested this solution on iphone 5s and it was taken 10-15% CPU only when you scrolling uitableView with visible web cell.

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
       //TODO: Remove this fix when WKWebView will fixed
       if let cell = tableView.cellForRow(at: IndexPath(row: 1, section: 0)) as? WKWebViewCell {
          // Here we take our cell
          cell.wkWebView?.setNeedsLayout() 
          // here is "magic" (where wkWebView it is WKWebView, which was 
          // previously added on cell)
       }
    }
    

提交回复
热议问题