I have to set an UIView
in fullscreen Programatically for all devices like: iPhone 3GS, 4, 4S, 5, 5S, 5C.
I googled so many times and get a answer but its not coming properly. 20 pixel is less from bottom part. I share my screenshot please see and let me know what i have to do.
My Code is :
UIView *myview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] applicationFrame].size.width, [[UIScreen mainScreen] applicationFrame].size.height)];
[myview setBackgroundColor:[UIColor grayColor]];
[self.view addSubview: myview];
See properly from bottom its 20 pixel is white. How can i manage that. ?
Try this one:
UIView *myview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)];
[myview setBackgroundColor:[UIColor grayColor]];
[self.view addSubview:myview];
I'll clarify you properly, i think you can understand.
It's a little bit difference in between [[UIScreen mainScreen] bounds] & [[UIScreen mainScreen] applicationFrame].
When you take UIScreen
for it's Bounds you get the whole device screen. (include status bar).There is no relationship between the two calls except that the applicationFrame
is returned in the UIScreen
bounds coordinate system.
UIView *myview = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[myview setBackgroundColor:[UIColor grayColor]];
[self.window addSubview: myview];
NSLog(@"FRAME: %@",NSStringFromCGRect(myview.bounds));
2014-09-11 12:17:37.451 Test[21793:60b] FRAME: {{0, 0}, {320, 480}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With