开发者

UiWebView reset zoom programmatically

开发者 https://www.devze.com 2023-01-10 05:12 出处:网络
Is there a way to zoom out or reset a UiWebView progra开发者_开发知识库mmatically ? if yes how ? i think you should be able to manipulate the viewport using the safari meta tags

Is there a way to zoom out or reset a UiWebView progra开发者_开发知识库mmatically ? if yes how ?


i think you should be able to manipulate the viewport using the safari meta tags

https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html#//apple_ref/doc/uid/TP40008193-SW6

For example, to set the viewport width to the width of the device, add this to your HTML file:

<meta name = "viewport" content = "width = device-width">

To set the initial scale to 1.0, add this to your HTML file:

<meta name = "viewport" content = "initial-scale = 1.0">

To set the initial scale and to turn off user scaling, add this to your HTML file:

<meta name = "viewport" content = "initial-scale = 2.3, user-scalable = no">


It's not directly supported, but this thread has a workaround/solution.


If you want to reset the user scale to 1.0, at least on iOS 4.2 you can toggle scalesPageToFit:

webView.scalesPageToFit = NO;
webView.scalesPageToFit = YES;
0

精彩评论

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