IOS8中的帧错误大小

时间:2014-09-18 11:19:08

标签: uiwebview ios8

我在应用内加载网页视图时出现问题。

问题仅出现在ios8上,而在ios7中表示正常

这是代码

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear: animated];
[ [ UIApplication sharedApplication ] setStatusBarHidden: YES withAnimation: UIStatusBarAnimationNone ];
webView.scrollView.minimumZoomScale = 1.0;
webView.scrollView.maximumZoomScale = 1.0;
webView.scrollView.bouncesZoom = NO;
webView.scrollView.multipleTouchEnabled = NO;
webView.scrollView.bounces = NO;
webView.mediaPlaybackRequiresUserAction = NO;
webView.allowsInlineMediaPlayback = YES;
webView.scalesPageToFit = YES;
self.view = webView;
webView.dataDetectorTypes = UIDataDetectorTypeNone;

NSURL *url = [[NSBundle mainBundle] URLForResource:@"dv/index" withExtension:@"html"];
[ webView loadRequest:[NSURLRequest requestWithURL: url ] ];
}

这是结果https://dl.dropboxusercontent.com/u/552704/view.png

1 个答案:

答案 0 :(得分:0)

我认为问题在于定位webView的代码(可能是UIWebView),你可能正在使用[[UIScreen mainScreen] bounds].size,它已经在iOS 8中变得依赖于旋转,参见

Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?