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,11 +221,16 @@ | ||
| 221 | } | 221 | } |
| 222 | - (void)getWebViewHeight{ | 222 | - (void)getWebViewHeight{ |
| 223 | [_webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error){ | 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 | view.frame = CGRectMake(0, 0, MainScreenWidth, _webView.height); | 232 | view.frame = CGRectMake(0, 0, MainScreenWidth, _webView.height); |
| 233 | + self.tableView.tableHeaderView = view; | ||
| 229 | [self.tableView reloadData]; | 234 | [self.tableView reloadData]; |
| 230 | }]; | 235 | }]; |
| 231 | } | 236 | } |
| @@ -296,7 +301,11 @@ | @@ -296,7 +301,11 @@ | ||
| 296 | WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; | 301 | WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init]; |
| 297 | wkWebConfig.userContentController = wkUController; | 302 | wkWebConfig.userContentController = wkUController; |
| 298 | 303 | ||
| 304 | + | ||
| 299 | _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, MainScreenWidth, 1) configuration:wkWebConfig]; | 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 | _webView.scrollView.backgroundColor = [UIColor whiteColor]; | 309 | _webView.scrollView.backgroundColor = [UIColor whiteColor]; |
| 301 | _webView.scrollView.showsVerticalScrollIndicator = NO; | 310 | _webView.scrollView.showsVerticalScrollIndicator = NO; |
| 302 | _webView.backgroundColor = [UIColor whiteColor]; | 311 | _webView.backgroundColor = [UIColor whiteColor]; |
| @@ -484,6 +493,7 @@ | @@ -484,6 +493,7 @@ | ||
| 484 | 493 | ||
| 485 | [webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error){ | 494 | [webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result, NSError * _Nullable error){ |
| 486 | CGFloat graphicLiveHeight = [result floatValue]; | 495 | CGFloat graphicLiveHeight = [result floatValue]; |
| 496 | + heightArr[0] = [NSString stringWithFormat:@"%f", graphicLiveHeight]; | ||
| 487 | _webView.height = graphicLiveHeight+30; | 497 | _webView.height = graphicLiveHeight+30; |
| 488 | [self.tableView reloadData]; | 498 | [self.tableView reloadData]; |
| 489 | if (!hasLoad) { | 499 | if (!hasLoad) { |