Set UIWebView size to fit screen size

When developing iOS app for ios 7 you will have some problem with screen size (because iphone 5 is preloaded with ios 7, the screen size of iphone 5 is different with any iphone 4, iphone 3GS...).

Here is a little trick to help you set any UIView to fit the screen size

for example here is an UIWebView, normally I would d this:

webview = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];

The code above will give you a webview with a black space at the bottom of the screen when run on Iphone 5. So I will use this code to set the frame of my webview to screen size:


webview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

Comments

Popular posts from this blog

No visible @interface for class declares the selector

SFML - Lập trình game - Cài Đặt

IOS UniqueIdentifier in ios 7 (xCode 5)