Reputation: 309
I am using storyboards. I am unable to resize webview according to the screen size in my storyboard.
I want header to be of same size for both resolution but change the height of webview according to screen resolution.
I can't use Autolayout because I want to deploy my app for ios5 and above.
Please help.
Upvotes: 0
Views: 1781
Reputation: 49730
you can set Your Webview
frame according to UIScreen
like Bellow where you alloc your `webview
CGRect webFrame = [[UIScreen mainScreen] applicationFrame];
webFrame.origin.y -= 20.0; // statusbar 20 px cut from y of frame
webView = [[UIWebView alloc] initWithFrame:webFrame];
webView.scalesPageToFit = YES;
webView.autoresizesSubviews = YES;
webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[webView setBackgroundColor:[UIColor clearColor]];
Upvotes: 2
Reputation: 1898
In your .m file under viewDidLoad
add this code.
webview.frame = CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height);
Add a referencing outlet of your web view to webView and then that should set the webView height to your view height.
Explanation: The view will get longer when you deploy to a 4 inch simulator causing the webView to change to the view's size.
Upvotes: 0