mr_app
mr_app

Reputation: 1312

Scaling UIWebView to fit full screen in iOS5 and iOS6

I have a problem with scaling the UIWebView. I want that the WebView is running in fullscreen on both versions (iOS5 and iOS6). I had to turn off "use AutoLayout" to get my app running on iOS5 too. My Problem is that my webView is higher than the the iOS5 Screen.

My question:

Is there a way to fit the view for both devices?

Upvotes: 0

Views: 1245

Answers (1)

Alex Stuckey
Alex Stuckey

Reputation: 1260

You need to manually code for the view to change size based on the screen size.

You can fetch the screen size (specifically height):

[[UIScreen mainScreen] bounds].size.height;
[[UIScreen mainScreen] bounds].size.width;

Then you set the size of the UIWebView with these values.

webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, [[UIScreen mainScreen] bounds].size.height)];

Upvotes: 1

Related Questions