UIWebview中的iOS6 contentInset与iOS7的行为不同

时间:2014-06-16 06:15:21

标签: ios7 ios6 uiwebview uiscrollview contentsize

我尝试在Webview中添加空格,因此内容非常适合Webview,就像实现UIViewContentModeScaleAspectFit一样。 webview的superview固定为320 * 200,webview的内容大小各不相同,但足够小,以适应大小。除了使用iOS 6外,一切正常。

float verticalInset = (self.frame.size.height - fitSize.height) / 2;
float horizontalInset = (self.frame.size.width - fitSize.width) / 2;
wv.scrollView.contentInset = UIEdgeInsetsMake(verticalInset, horizontalInset, verticalInset, horizontalInset);
wv.center = self.center;

fitSize是正确计算的,因为如果我只是将webview的框架设置为大小,则内容非常适合。但是,在放大时,这不会填满其超级视图。

似乎当我在iOS 6中更改contentInset时,它不会调整其内容的大小以适应结果框架(frame-inset);但iOS 7会调整它的大小。有没有解决这个差异的解决方案?

0 个答案:

没有答案