Commit 5fdc06beb348653a34e01fca0cb493603a7d87e1
1 parent
8e85e45f
no message
Showing
1 changed file
with
15 additions
and
16 deletions
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldArticleDetailViewController.m
| ... | ... | @@ -478,23 +478,22 @@ |
| 478 | 478 | NSString *javascriptWithCSSString = [NSString stringWithFormat:javascriptString, cssString]; |
| 479 | 479 | [webView evaluateJavaScript:javascriptWithCSSString completionHandler:nil]; |
| 480 | 480 | |
| 481 | - CGRect frame = _webView.frame; | |
| 482 | - frame.size.width = MainScreenWidth; | |
| 483 | - frame.size.height = 1; | |
| 484 | - _webView.frame = frame; | |
| 485 | - CGFloat graphicLiveHeight = _webView.scrollView.contentSize.height; | |
| 486 | - frame.size.height = _webView.scrollView.contentSize.height; | |
| 487 | - _webView.frame = frame; | |
| 481 | + [webView evaluateJavaScript:@"document.body.scrollHeight" completionHandler:^(id _Nullable result,NSError * _Nullable error){ | |
| 482 | + CGFloat graphicLiveHeight = [result floatValue]; | |
| 483 | + CGRect frame = _webView.frame; | |
| 484 | + frame.size.height = _webView.scrollView.contentSize.height; | |
| 485 | + _webView.frame = frame; | |
| 486 | + if (0 == [heightArr[fontIndex] floatValue]) { | |
| 487 | + [heightArr replaceObjectAtIndex:fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 488 | + } | |
| 489 | + [self.scrollView.mj_header endRefreshing]; | |
| 490 | + [_webView setFrame:CGRectMake(0, 0, MainScreenWidth, [heightArr[fontIndex] floatValue])]; | |
| 491 | + [self.scrollView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue])]; | |
| 492 | + if (!hasLoad) { | |
| 493 | + [self loadProgramRelativeData]; | |
| 494 | + } | |
| 495 | + }]; | |
| 488 | 496 | |
| 489 | - if (0 == [heightArr[fontIndex] floatValue]) { | |
| 490 | - [heightArr replaceObjectAtIndex:fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 491 | - } | |
| 492 | - [self.scrollView.mj_header endRefreshing]; | |
| 493 | - [_webView setFrame:CGRectMake(0, 0, MainScreenWidth, [heightArr[fontIndex] floatValue])]; | |
| 494 | - [self.scrollView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[fontIndex] floatValue])]; | |
| 495 | - if (!hasLoad) { | |
| 496 | - [self loadProgramRelativeData]; | |
| 497 | - } | |
| 498 | 497 | } |
| 499 | 498 | |
| 500 | 499 | -(void)pushPicController:(NSString *)url withPoint:(NSInteger)CurrentIndex { | ... | ... |