Objective-c – iOS7 Status Bar over Navigation Bar

ios6ios7iphoneobjective cxcode5

I'm testing my application with iOS7 and I have an issue with status bar. Basically the status bar appear over navigation bar like the image below:

iOS7 Status Bar Issue

I try to call in my viewDidLoad

 self.edgesForExtendedLayout = UIRectEdgeNone;
 self.automaticallyAdjustsScrollViewInsets = YES;

without success.

I have also added to the info.plist file UIViewControllerBasedStatusBarAppearance with no luck.

The main problem is that the application must be compatible with iOS6 and iOS7 and currently on iOS7 the view shifted 20px from the top.

Best Answer

edgesForExtendedLayout and automaticallyAdjustsScrollViewInsets are just standards for how parent view controllers lay out / manage the view. It looks like you're using a UINavigationBar, but not a UINavigationController, which means these properties won't do anything unless you code them to.

You can switch to use a UINavigationController, or you can programmatically change the height of your UINavigationBar from 44 to 64 on iOS 7.