WKWebView not rendering correctly in iOS 10

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

    In objective-C this is how I solve the problem.

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        NSArray * visibleCell = [self.tableView visibleCells];
    
        for (CustomUITableViewCell * cell in visibleCell) {
            if ([cell isKindOfClass:[CustomUITableViewCell class]]) {
                [cell.wkWebView setNeedsLayout];
            }
        }
    }
    

    That code will collect all visible cell and do the setNeedsLayout in fast enumeration during user scroll.

提交回复
热议问题