Commit df8caf8b367f57514b61d5434425f6a71898f76b

Authored by iOS-Xiaowen
1 parent 4792ce44

no message

CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
@@ -373,7 +373,15 @@ @@ -373,7 +373,15 @@
373 373
374 [backgroundView setContentSize:CGSizeMake(MainScreenWidth, height + descriptionHeight + 960)]; 374 [backgroundView setContentSize:CGSizeMake(MainScreenWidth, height + descriptionHeight + 960)];
375 375
376 - _webView = [[WKWebView alloc] initWithFrame:CGRectZero]; 376 + NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);";
  377 +
  378 + WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
  379 + WKUserContentController *wkUController = [[WKUserContentController alloc] init];
  380 + [wkUController addUserScript:wkUScript];
  381 +
  382 + WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
  383 + config.userContentController = wkUController;
  384 + _webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
377 _webView.scrollView.backgroundColor = [UIColor clearColor]; 385 _webView.scrollView.backgroundColor = [UIColor clearColor];
378 // _webView.dataDetectorTypes = UIDataDetectorTypeNone; 386 // _webView.dataDetectorTypes = UIDataDetectorTypeNone;
379 _webView.backgroundColor = [UIColor clearColor]; 387 _webView.backgroundColor = [UIColor clearColor];