Commit 6f7fd7ac91924eea95789a77ef59ec149628f498
1 parent
af147b98
iphone12pro视频(答记者问、国新视界等)未显示标题、来源、简介等信息 (软件系统14.3)
Showing
1 changed file
with
22 additions
and
17 deletions
CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
| ... | ... | @@ -78,6 +78,7 @@ |
| 78 | 78 | [self.liveController stop]; |
| 79 | 79 | self.liveController = nil; |
| 80 | 80 | self.videoController = nil; |
| 81 | + [_webView.scrollView removeObserver:self forKeyPath:@"contentSize" context:@"WebKitContext"]; | |
| 81 | 82 | NSLog(@"delloc"); |
| 82 | 83 | } |
| 83 | 84 | - (void)loadShareView { |
| ... | ... | @@ -254,9 +255,25 @@ |
| 254 | 255 | } else { |
| 255 | 256 | [self addZXVideo:movieUrl]; |
| 256 | 257 | } |
| 257 | - | |
| 258 | + [_webView.scrollView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:@"WebKitContext"]; | |
| 258 | 259 | } |
| 259 | 260 | |
| 261 | +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { | |
| 262 | + | |
| 263 | + if ([keyPath isEqualToString:@"contentSize"] && !_webView.loading && _webView.height != _webView.scrollView.contentSize.height) { | |
| 264 | + CGRect frame = self->_webView.frame; | |
| 265 | + frame.size.width = MainScreenWidth; | |
| 266 | + frame.size.height = 1; | |
| 267 | + CGFloat graphicLiveHeight = self->_webView.scrollView.contentSize.height; | |
| 268 | + frame.size.height = self->_webView.scrollView.contentSize.height; | |
| 269 | + NSLog(@"YYYYYYYYYYY%f",self->_webView.scrollView.contentSize.height); | |
| 270 | + self->_webView.frame = frame; | |
| 271 | + if (0 == [self->heightArr[self->fontIndex] floatValue]) { | |
| 272 | + [self->heightArr replaceObjectAtIndex:self->fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 273 | + } | |
| 274 | + [self loadRelatedInformation]; | |
| 275 | + } | |
| 276 | +} | |
| 260 | 277 | // CNLivePlayer |
| 261 | 278 | - (void)addCNLivePlayer { |
| 262 | 279 | |
| ... | ... | @@ -409,23 +426,11 @@ |
| 409 | 426 | "}" |
| 410 | 427 | "}\";" |
| 411 | 428 | "document.getElementsByTagName('head')[0].appendChild(script);",width]; |
| 412 | - [webView evaluateJavaScript:@"ResizeImages();" completionHandler:nil]; | |
| 413 | - [webView evaluateJavaScript:string completionHandler:^(id _Nullable response, NSError * _Nullable error) { | |
| 429 | + [_webView evaluateJavaScript:@"ResizeImages();" completionHandler:nil]; | |
| 430 | + [_webView evaluateJavaScript:string completionHandler:^(id _Nullable response, NSError * _Nullable error) { | |
| 414 | 431 | NSLog(@"value: %@ error: %@", response, error); |
| 415 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 416 | - CGRect frame = self->_webView.frame; | |
| 417 | - frame.size.width = MainScreenWidth; | |
| 418 | - frame.size.height = 1; | |
| 419 | - self->_webView.frame = frame; | |
| 420 | - CGFloat graphicLiveHeight = self->_webView.scrollView.contentSize.height; | |
| 421 | - frame.size.height = self->_webView.scrollView.contentSize.height; | |
| 422 | - self->_webView.frame = frame; | |
| 423 | - if (0 == [self->heightArr[self->fontIndex] floatValue]) { | |
| 424 | - [self->heightArr replaceObjectAtIndex:self->fontIndex withObject:[NSString stringWithFormat:@"%f",graphicLiveHeight]]; | |
| 425 | - } | |
| 426 | - }); | |
| 432 | + | |
| 427 | 433 | }]; |
| 428 | - [self loadRelatedInformation]; | |
| 429 | 434 | } |
| 430 | 435 | - (void)loadRelatedInformation { |
| 431 | 436 | if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { |
| ... | ... | @@ -455,7 +460,7 @@ |
| 455 | 460 | // self.errorLabe.hidden = NO; |
| 456 | 461 | } |
| 457 | 462 | NSLog(@"%@",NSStringFromCGRect(self.tableView.frame)); |
| 458 | - [self->backgroundView setContentSize:CGSizeMake(MainScreenWidth, [heightArr[self->fontIndex] floatValue] + self.tableView.frame.size.height)]; | |
| 463 | + [self->backgroundView setContentSize:CGSizeMake(MainScreenWidth, [self->heightArr[self->fontIndex] floatValue] + self.tableView.frame.size.height)]; | |
| 459 | 464 | [self.tableView reloadData]; |
| 460 | 465 | } else { |
| 461 | 466 | [AlertViewTool showHUDViewText:_dic[@"errorMessage"]]; | ... | ... |