开发者

Content in UIWebView on iOS 3.1.3 appears zoomed on but on iOS 4.3 appears fine

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

Device #1 -> iPod 2G / iOS 3.1.3

Device #2 -> iPhone 4 / iOS 4.3

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 confirm开发者_C百科ed at the moment. Wondering if anyone has encountered this type of behaviour before.

Any and all help is appreciated.


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;' />

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%

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜