开发者

UIWebView Zoom Level

开发者 https://www.devze.com 2023-03-13 14:30 出处:网络
I have to check the zoom level of UIWebView. And set its maximum level to certain Level. I have tried this code but found no success

I have to check the zoom level of 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


I had the same problem and found the solution from Vocaro's post to solve the problem!

"Add the following meta tag to your HTML document's head:

<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

0

精彩评论

暂无评论...
验证码 换一张
取 消