UiWebView以编程方式重置缩放 [英] UiWebView reset zoom programmatically

查看:161
本文介绍了UiWebView以编程方式重置缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式缩小或重置UiWebView?如果有,怎么样?

Is there a way to zoom out or reset a UiWebView programmatically ? if yes how ?

推荐答案

我认为你应该可以使用safari元标记操作视口

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

例如,要将视口宽度设置为设备的宽度,请将其添加到HTML文件中:

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">

要将初始比例设置为1.0,请将其添加到HTML文件中:

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

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

要设置初始比例并关闭用户缩放,请将其添加到HTML文件中:

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">

这篇关于UiWebView以编程方式重置缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆