在自定義cell中有webview准脂,tableView的高度必須根據(jù)webview顯示的高度來(lái)決定!
計(jì)算出來(lái)webview的高度以后谊迄,
在webviewdidfinishload 方法里面調(diào)用[_tableView beginUpdates];[_tableView endUpdates];進(jìn)行tableview高度刷新就可以了哮独。
- (void)webViewDidFinishLoad:(UIWebView *)webView {
CGRect frame = webView.frame;
frame.size = [webView sizeThatFits:CGSizeZero];
frame.size.height += 20.0f; // 額外的填充使其可以加載到底部
webView.frame = frame;
webView.delegate = nil;
UITableViewCell *cell =[_cells objectAtIndex:webView.tag];
[cell.contentView addSubview:_loadingWebView];
cell.contentView.frame = frame;
[cell setNeedsLayout];
webView.alpha = 1.0f;
[self.tableView beginUpdates];
NSArray *paths = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:0 inSection:webView.tag]];
[self.tableView insertRowsAtIndexPaths:paths withRowAnimation:UITableViewRowAnimationNone];
[self.tableView endUpdates];
_loadingWebView = nil;
}