Commit 6f7fd7ac91924eea95789a77ef59ec149628f498

Authored by yanglingyu
1 parent af147b98

iphone12pro视频(答记者问、国新视界等)未显示标题、来源、简介等信息 (软件系统14.3)

CNLiveScioLive/Pages/Home/新闻详情/OldController/OldVideoDetailViewController.m
@@ -78,6 +78,7 @@ @@ -78,6 +78,7 @@
78 [self.liveController stop]; 78 [self.liveController stop];
79 self.liveController = nil; 79 self.liveController = nil;
80 self.videoController = nil; 80 self.videoController = nil;
  81 + [_webView.scrollView removeObserver:self forKeyPath:@"contentSize" context:@"WebKitContext"];
81 NSLog(@"delloc"); 82 NSLog(@"delloc");
82 } 83 }
83 - (void)loadShareView { 84 - (void)loadShareView {
@@ -254,9 +255,25 @@ @@ -254,9 +255,25 @@
254 } else { 255 } else {
255 [self addZXVideo:movieUrl]; 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 // CNLivePlayer 277 // CNLivePlayer
261 - (void)addCNLivePlayer { 278 - (void)addCNLivePlayer {
262 279
@@ -409,23 +426,11 @@ @@ -409,23 +426,11 @@
409 "}" 426 "}"
410 "}\";" 427 "}\";"
411 "document.getElementsByTagName('head')[0].appendChild(script);",width]; 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 NSLog(@"value: %@ error: %@", response, error); 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 - (void)loadRelatedInformation { 435 - (void)loadRelatedInformation {
431 if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) { 436 if (![[Reachability reachabilityForInternetConnection] currentReachabilityStatus]) {
@@ -455,7 +460,7 @@ @@ -455,7 +460,7 @@
455 // self.errorLabe.hidden = NO; 460 // self.errorLabe.hidden = NO;
456 } 461 }
457 NSLog(@"%@",NSStringFromCGRect(self.tableView.frame)); 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 [self.tableView reloadData]; 464 [self.tableView reloadData];
460 } else { 465 } else {
461 [AlertViewTool showHUDViewText:_dic[@"errorMessage"]]; 466 [AlertViewTool showHUDViewText:_dic[@"errorMessage"]];