2018-12-03

UIWebView中缩放问题的解决

//方法中注入了段js代码
- (void)webViewDidFinishLoad:(UIWebView *)webView.

NSString *jsMeta = [NSString stringWithFormat:@"var meta = document.createElement('meta');meta.content='width=device-width,initial-scale=1.0,minimum-scale=.5,maximum-scale=3';meta.name='viewport';document.getElementsByTagName('head')[0].appendChild(meta);"];


[_webView stringByEvaluatingJavaScriptFromString:jsMeta];

你可能感兴趣的:(2018-12-03)