How to fix status bar overlapping issue in ios 7

I am developing an application that works great on IOS6. But in iOS7, the status bar overlaps with the view.

As an example: IOS7

I need the status bar first and then my icons and Delete last. So give me some idea on how to remove the overlap.

but i need it

enter image description here Please give me an idea of ​​my problem.


source to share

4 answers


 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) 
    self.view.clipsToBounds = YES;
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    CGFloat screenHeight = 0.0;
    if(UIDeviceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
        screenHeight = screenRect.size.height;
        screenHeight = screenRect.size.width;
    CGRect screenFrame = CGRectMake(0, 20, self.view.frame.size.width,screenHeight-20);
    CGRect viewFr = [self.view convertRect:self.view.frame toView:nil];
    if (!CGRectEqualToRect(screenFrame, viewFr))
        self.view.frame = screenFrame;
        self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);





has iOS 6/7 Deltas which is specifically designed to address this issue. You have to move your views 20px down to look directly at iOS 7, and to make it compatible with iOS 6, you changed Delta y to -20.

enter image description here

Resize the height of the views on iOS 6. You needed to set the height to Delta as well as Delta Y.

You can also see this - Fix iOS 7 Status Bar Overlapped



Try this code. Use this code in your AppDelegate.m in did finishlaunching:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);




This is the default behavior for UIViewController on iOS 7. The view will be full screen and the status bar will cover the top of the view. If you have your navigationBar hidden, then you have to adjust all UIView elements by shifting 20 points.



All Articles