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
You do want to set the barPosition
of the UINavigationBar
.
You can do this in code:
Let your ViewController conform to protocol UINavigationBarDelegate
and implement positionBar: metod. (The protocol that you really need is UIBarPositioningDelegate
but UINavigationBarDelegate
does extend it.)
@interface SampleViewController ()
@property (weak, nonatomic) IBOutlet UINavigationBar *navigationBar;
@end
@implementation SampleViewController
- (void)viewDidLoad {
[super viewDidLoad];
_navigationBar.delegate = self;
}
- (UIBarPosition)positionForBar:(id)bar {
return UIBarPositionTopAttached;
}
@end
OR in Storyboard:
In the Identity Inspector of UINavigationBar
, add a User Defined runtime Attribute with KeyPath = barPosition, Type = Number, and Value = 3: