You must keep the line height when the web view finishes loading, and then refresh the table:
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[webView sizeToFit];
self.rowHeight = webView.bounds.size.height;
[tableView reloadData];
}
And you update the method tableView:heightForRowAtIndexPath:as follows:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.rowHeight ? self.rowHeight : 50;
}
You must define an attribute CGFloat rowHeightfor your class.
source
share