Commit 4f69aa16719b15c7f99573cf2e5f736a6e26082a
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/ScioLive
Showing
1 changed file
with
14 additions
and
4 deletions
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| ... | ... | @@ -221,11 +221,16 @@ |
| 221 | 221 | } |
| 222 | 222 | - (void)getWebViewHeight{ |
| 223 | 223 | [_webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error){ |
| 224 | - CGFloat graphicLiveHeight = [result floatValue]; | |
| 225 | - _webView.height = graphicLiveHeight+30; | |
| 226 | - UIView *view = self.tableView. tableHeaderView; | |
| 227 | - [view sizeToFit]; | |
| 224 | + CGFloat graphicLiveHeight = [heightArr[fontIndex] floatValue]; | |
| 225 | + if (graphicLiveHeight > 5.0) { | |
| 226 | + } else { | |
| 227 | + graphicLiveHeight = [result floatValue]; | |
| 228 | + heightArr[fontIndex] = [NSString stringWithFormat:@"%f", graphicLiveHeight]; | |
| 229 | + } | |
| 230 | + _webView.height = graphicLiveHeight+30; | |
| 231 | + UIView *view = self.tableView.tableHeaderView; | |
| 228 | 232 | view.frame = CGRectMake(0, 0, MainScreenWidth, _webView.height); |
| 233 | + self.tableView.tableHeaderView = view; | |
| 229 | 234 | [self.tableView reloadData]; |
| 230 | 235 | }]; |
| 231 | 236 | } |
| ... | ... | @@ -296,7 +301,11 @@ |
| 296 | 301 | WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; |
| 297 | 302 | wkWebConfig.userContentController = wkUController; |
| 298 | 303 | |
| 304 | + | |
| 299 | 305 | _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, MainScreenWidth, 1) configuration:wkWebConfig]; |
| 306 | + CGRect frame = _webView.frame; | |
| 307 | + frame.size.height = 0; | |
| 308 | + _webView.frame = frame; | |
| 300 | 309 | _webView.scrollView.backgroundColor = [UIColor whiteColor]; |
| 301 | 310 | _webView.scrollView.showsVerticalScrollIndicator = NO; |
| 302 | 311 | _webView.backgroundColor = [UIColor whiteColor]; |
| ... | ... | @@ -484,6 +493,7 @@ |
| 484 | 493 | |
| 485 | 494 | [webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error){ |
| 486 | 495 | CGFloat graphicLiveHeight = [result floatValue]; |
| 496 | + heightArr[0] = [NSString stringWithFormat:@"%f", graphicLiveHeight]; | |
| 487 | 497 | _webView.height = graphicLiveHeight+30; |
| 488 | 498 | [self.tableView reloadData]; |
| 489 | 499 | if (!hasLoad) { | ... | ... |