Hasani Hunter
Home
Archives
RSS Feed
@hasanihunter
© 2025 Hasani Hunter
September, 1 2013

Dealing with iOS 7 status bars

For those developers who want to preserve the iOS 6 status bar behavior ( basically making sure that your content resides below the status bar ) you can use the following code snippet in the top most UIViewController’s viewDidAppear method:

 

 

-(void)viewDidAppear:(BOOL)animated

 

{

    if ( [ self respondsToSelector:@selector(edgesForExtendedLayout)])

    {

        CGFloat statusBarHeight = 20.0f;

        

        CGRect frame = self.view.frame;

        frame.origin.y += statusBarHeight;

        frame.size.height -= statusBarHeight;

        self.view.frame = frame;

    }

}

https://hasani.me/Bg