- (void)addWKWebView { _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0.1)]; [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_activityModel.shareLink]]]; _webView.scrollView.scrollEnabled = NO; _webView.UIDelegate = self; _webView.navigationDelegate = self; [_tableView setTableHeaderView:_webView]; [SVProgressHUD show]; } - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { [webView evaluateJavaScript:@"document.getElementById("content").offsetHeight" completionHandler:^(id _Nullable result,NSError * _Nullable error) { // 获取页面高度,并重置webview的frame _webViewHeight = [result doubleValue]; CGRect frame = webView.frame; frame.size.height = _webViewHeight; webView.frame = frame; [_tableView beginUpdates]; [_tableView setTableHeaderView:_webView]; [_tableView endUpdates]; [self getActivityComments]; }]; } - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation{ } - (void)addTableView { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT-64- 40) style:UITableViewStylePlain]; [_tableView setBackgroundColor:[UIColor clearColor]]; [_tableView setDelegate:self]; [_tableView setDataSource:self]; _tableView.tableFooterView = [UIView new]; _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; _tableView.separatorColor = SEPARATOR_COLOR_SYSTEM; [self.view addSubview:_tableView]; [self loadLoadMoreFooter:_tableView action:@selector(loadMoreData)]; }