iOS 3.1.3上的UIWebView中的内容显示为放大,但在iOS 4.3上显示正常 [英] Content in UIWebView on iOS 3.1.3 appears zoomed on but on iOS 4.3 appears fine

查看:68
本文介绍了iOS 3.1.3上的UIWebView中的内容显示为放大,但在iOS 4.3上显示正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试我在两个不同设备上的UIWebView行为的差异。首先是我正在测试的设备列表...

I am running into a difference in UIWebView behaviour on two different devices I am testing. First here is the listing of devices I am testing with...

设备#1 - > iPod 2G / iOS 3.1.3

Device #1 -> iPod 2G / iOS 3.1.3

设备#2 - > iPhone 4 / iOS 4.3

Device #2 -> iPhone 4 / iOS 4.3

我有相同的HTML内容正在两个设备上加载,但当它加载到iPod上时,内容会显示放大。在iPhone上,内容显示正确。据我所知,我认为这可能与视网膜显示器有关,也许iPhone本身可以接受更高分辨率的内容,但我目前还没有任何确认。想知道以前是否有人遇到过这种行为。

I have the same HTML content being loaded on both devices but when it's loaded on the iPod the content appears zoomed in. On the iPhone the content appears correctly. From what I know I think this may have to do with retina display and perhaps the iPhone can natively accept content at a larger resolution but I have nothing confirmed at the moment. Wondering if anyone has encountered this type of behaviour before.

感谢任何和所有帮助。

推荐答案

您应该将UIWebView的scalesPageToFit设置为YES并在您的html标题中插入此元标记:

You should set scalesPageToFit of your UIWebView to YES and insert this meta tag in your html header:

<meta name='viewport' content='width=device-width; initial-scale=1.0;' />

CONTENT有很多参数,其中一些是:

There are plenty of parameters for CONTENT, some of them are:

maximum-scale=3.0; //Maximum zoom allowed 0 to 10.0. default is 1.6
minimum-scale=0.5; //Minimum zoom allowed 0 to 10.0. default is 0.25
user-scalable=1; //YES/NO
width=device-width; //default if not set is 980px 
initial-scale=1.0; //Initial zoom. 0 to 10.0. 1.0 would be 100%

这样你的UIWebView就可以按照你想要的方式显示你的网页。
希望这会有所帮助!

This way your UIWebView should display your web the way you want. Hope this helps!

这篇关于iOS 3.1.3上的UIWebView中的内容显示为放大,但在iOS 4.3上显示正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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