I have followed the following tutorial to move my navigation bar down so it is not covered by the status bar in xcode 5/ios7:
Status bar and navigation bar issue in
If you want to stretch a UINavigationBar with a custom background-image behind the UIStatusBar in iOS 7 consider the following:
In code (iPhone ONLY):
// Image needs 64 points height
NSString* navBarPortraitBackgroundPath = [[NSBundle mainBundle] pathForResource:@"navBarPortraitBackground" ofType:@"png"];
NSString* navBarLandscapeBackgroundPath;
if(UIScreen.mainScreen.bounds.size.height == 568){
// Image needs 64 points height
navBarLandscapeBackgroundPath = [[NSBundle mainBundle] pathForResource:@"navBarWideLandscapeBackground" ofType:@"png"];
} else {
// Image needs 64 points height
navBarLandscapeBackgroundPath = [[NSBundle mainBundle] pathForResource:@"navBarLandscapeBackground" ofType:@"png"];
}
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageWithContentsOfFile:navBarPortraitBackgroundPath] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageWithContentsOfFile:navBarLandscapeBackgroundPath] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsLandscapePhone];
If you just want to change to background colour of the UINavigationBar it will automatically extend behind the UIStatusBar.
In Code:
[UINavigationBar appearance].barTintColor = [UIColor redColor];