简体   繁体   English

加载在线网页后是否可以更改UIWebView的比例?

[英]Is it possible to change the scale of UIWebView after loading an online web page?

I would like users to pinch in my UIWebView and already set the ScaleToFitPages to YES. 我希望用户捏住我的UIWebView并将ScaleToFitPages设置为YES。

The page content does not contains anything like 页面内容不包含类似

<meta name='viewport' content='width=device-width; initianl-scale=1; maximum-scale:4; ....'>   

Could I use any javascript code(jquery or not with jquery) to change the scale to original scale(1:1) after the page loaded(eg. in the delegate method didFinishLoading ...) 我可以使用任何JavaScript代码(用jquery还是不使用jquery)在页面加载后将比例更改为原始比例(1:1)(例如,在委托方法didFinishLoading ...)

In UIWebViewDelegate , there is protocol webViewDidFinishLoad: that will be call after a web view finishes loading a frame. 在UIWebViewDelegate中,有一个协议webViewDidFinishLoad:会在Web视图完成框架加载后调用。

so you can put some javascript that custom the scale 所以您可以放一些自定义比例的javascript

[webView stringByEvaluatingJavaScriptFromString: [NSString stringWithFormat:@"your javascript code" ];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM