Commit df8caf8b367f57514b61d5434425f6a71898f76b
1 parent
4792ce44
no message
Showing
1 changed file
with
9 additions
and
1 deletions
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
| ... | ... | @@ -373,7 +373,15 @@ |
| 373 | 373 | |
| 374 | 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 | 385 | _webView.scrollView.backgroundColor = [UIColor clearColor]; |
| 378 | 386 | // _webView.dataDetectorTypes = UIDataDetectorTypeNone; |
| 379 | 387 | _webView.backgroundColor = [UIColor clearColor]; | ... | ... |