Question

I'm working on an app which has an UIWebView and the page it loads is just set by:

NSURL *url = [NSURL URLWithString:@""]; NSURLRequest *requestURL = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestURL];

However what I noticed when I run the app on the 3.5" simulator is that it basically chops of part of the app so you won't be able to see the whole webpage in the app.

The UIWebView is just set and placed within the Storyboard.

So basically I was wondering how I can change the size of the UIWebView so it will fit a 3.5" iPhone?

Apologise for the noob question.

Was it helpful?

Solution 2

I think you are trying to accomplish the same thing I was, check out this question where I got my answer from or see the code below:

CGRect oldFrame = WebView.frame;

CGRect newFrame =CGRectMake(oldFrame.origin.x, oldFrame.origin.y, oldFrame.size.width, oldFrame.size.height-100);
[WebView setFrame:newFrame];

Also remember to uncheck the Auto Layout feature within Interface Builder / Storyboard.

OTHER TIPS

If you are using storyboard, there needs to be a constraint binding the UIWebView to the bottom of the screen. You probably bound the View to the top and then set a fixed height. Instead, you want to bind the View to the bottom and top of the screen and make the height flexible. Then, the View should adapt automatically to the screen size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top