简体   繁体   English

UIWebView缩放级别

[英]UIWebView Zoom Level

I have to check the zoom level of UIWebView. 我必须检查UIWebView的缩放级别。 And set its maximum level to certain Level. 并将其最大级别设置为特定级别。 I have tried this code but found no success 我尝试过此代码,但未成功

edited post to include code formatting 编辑过的帖子,包括代码格式

UIScrollView *sRouteView = [[testWebView subviews] objectAtIndex:0];
    sRouteView.delegate = self;
    sRouteView.minimumZoomScale = 1.0;
    sRouteView.maximumZoomScale = 2.0;
    sRouteView.zoomScale = sRouteView.minimumZoomScale;

I am unable to set maximum zoom level of UIWebView 我无法设置UIWebView的最大缩放级别

I had the same problem and found the solution from Vocaro's post to solve the problem! 我遇到了同样的问题,并从Vocaro的帖子中找到了解决问题的方法!

"Add the following meta tag to your HTML document's head: “将以下元标记添加到HTML文档的头部:

<meta name='viewport' content='initial-scale=1.0,maximum-scale=10.0'/>"

so basically for you 所以基本上是给你的

"<meta name='viewport' content='initial-scale=1.0,minimum-scale=1.0, maximum-scale=2.0'/>" 

should do the trick. 应该可以。

Documents https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html 文档https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html

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

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