0
votes

I have a webview.. with the following attributes:

1.scalesPageToFit

2.Autoresizing masks

3.contentmode = aspectFit

After loading it fits to the page as obvious. But as soon as i zoom in and then zoom out to normal; rotating the device doesn't fit completely.

As a tweak, i have checked if the orientation mode is landscape reload the web page. I read various posts in this regard, but couldn't find any solution.

3
I have answered your question. Kindly Check itAmir iDev

3 Answers

0
votes

You have 2 folowing options:

Add this into head section of your html file:

 <meta name="viewport" content="width=device-width" />

Or call [myWebView reload] when orientation changes

0
votes

You can use this Code

NSString *website =@"http://www.google.com";
NSURL *url = [NSURL URLWithString:website];
NSURLRequest *requestURL =[NSURLRequest requestWithURL:url];

mywebview.scalesPageToFit = YES;
mywebview.autoresizesSubviews = YES;    

[mywebview loadRequest:requestURL];
0
votes

It took more than 2 days to find out the reason causing this issue. Actually webview was working correctly except the fact that if you try to use PinchGesture to zoom out further.. webview will baheve in the same way.

To overcome this issue, we need to set the zoom scale of scroll view in Webview under willRotate method. However, it's animating weirdly but one can make a guess where the issue lies.