本文介绍了iOS 5和iOS 6 - UIWebView的行为差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 UIWebView 上测试一些HTML代码。我也希望同时支持iOS 5.x和iOS 6.x.但是,似乎只有与iOS 6.x相关的字体大小存在问题。

I am testing some HTML code on UIWebView. And am also wishing to support both iOS 5.x and iOS 6.x. But there seems to be a problem about font size associated with iOS 6.x only.

也就是说,在旋转时,iOS 5.x会在从横向模式更改为纵向时使字体略小(这是可取的,因为纵向宽度较短)。但是,iOS 6.x中的 UIWebView 恰恰相反。

That is, under rotation, iOS 5.x would make fonts slightly smaller when changing to portrait from landscape mode (which is desirable, since portrait's width is shorter). However, UIWebView in iOS 6.x would do just the opposite.

当在iOS Safari(5.x和6.x)中呈现相同的HTML代码时,问题不会出现,因为字体大小始终按预期进行缩放旋转。

The problem does not come up when the same HTML code is rendered in iOS Safari (both 5.x and 6.x), as font size always scales as expected during rotation.

这可能是我错过的关于 UIWebView 的事情,希望有人知道可以帮助解释这一点。

It could be something I've missed about UIWebView, hope somebody knowledgable could help to explain this.

此外,我的iPhone 5 iOS 6.1测试设备出现了上述问题。如果您发现或未发现任何类似问题,请发表评论。希望知道它是否仅与此特定手机(或其设置)相关联。

Also, the above problem comes up on my iPhone 5 iOS 6.1 test device. Please comment if you do or don't find any similar problem. Wish to know if it is only associated with this particular phone (or its settings) only.

最新更新:

上述问题应该与项目(在iOS 6可用之前很久就开始)的布局有关。已经在一些不同的基本设置中设置了一个新的测试项目,其中包含 UIWebView UIView ,以及文本自动调整旋转期间似乎在ios 5& 5中都没问题。 6.上述问题可能是由于使用的自定义布局调整代码,仅在iOS 5中有效。真的希望2 ios版本之间有更多的兼容性。

The above problem should be related to how the project (which started long before iOS 6 was available) is laid out. As have set up a new test project with a UIWebView and a UIView in some different basic setups, and the text autosizing during rotation seems to be ok in both ios 5 & 6. The above problem may be due to custom layout adjustment code used which is good only in iOS 5. Really wish there were more compatibility between the 2 ios versions.

推荐答案

请使用视点设置查看ios 5和ios 6的差异

Please use the viewpoint setting to see the difference in ios 5 and ios 6

这篇关于iOS 5和iOS 6 - UIWebView的行为差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:36