1

I have some problem when I load a web view inside my app.

Problem appears only with ios8, while in ios7 is ok

this is the code

- (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 ] ];
}

and this is the result https://dl.dropboxusercontent.com/u/552704/view.png

  • Your code is messy. It includes both YES and NO and YES again for scalesPageToFit. – Emiel Sep 18 '14 at 11:24
  • What should the result be? And is it the web view's frame that has the wrong size or is it the content in the web view that is sized wrong? – Emiel Sep 18 '14 at 11:37
  • the result should be a full screen webview. the web view's frame is smaller than the ios7 version and it's located not in the correct position but over the green frame. – user1931678 Sep 18 '14 at 11:56
  • ios8 version [link](https://dl.dropboxusercontent.com/u/552704/view.png) iOS7 version [link](https://dl.dropboxusercontent.com/u/552704/view2.png) – user1931678 Sep 18 '14 at 11:57

1 Answers1

0

I think the problem is in the code that positions the webView (probably a UIWebView), you are probably using [[UIScreen mainScreen] bounds].size which has become rotation dependent in iOS 8, see

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

Community
  • 1
  • 1
Andreas Paulsson
  • 7,745
  • 3
  • 25
  • 31