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 IOS7
But now in iOS7 there is a blank space at the top where the status bar would be and I would like the navigation bar to fill this area too
For instance, Facebook/twittter/Instagram iOS7 apps have the navigation bar background behind the status bar too. How do I achieve this?
Sorry if I'm not being clear but really eager to get this sorted
Thank you!
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 () <UINavigationBarDelegate>
@property (weak, nonatomic) IBOutlet UINavigationBar *navigationBar;
@end
@implementation SampleViewController
- (void)viewDidLoad {
[super viewDidLoad];
_navigationBar.delegate = self;
}
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)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:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With