Reputation: 2541
I want add 20 points margin to my navigation bar. I need it because I want another background color under status bar as youtube did:
I found
iOS Developer library says: Status bar background appearance provided by the window background, if using UIBarPositionTop.
I found solution for toolbar, but I can't move my navigation bar inside navigation view controller. I just set UIBarPositionTop for my navigation bar, but it changes nothing.
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
NSLog(@"position method called");
return UIBarPositionTop;
}
I still see the gray background of status bar instead of white.
Is it possible to do it with a navigation bar or should I use a view with a toolbar?
(XCode 6, development target 7.0+, sdk 8.0, autolayout)
I read this question and understood, that there is no need to add margin. I added view with background color I need over my navigation bar controller and it resolved my problem.
Upvotes: 1
Views: 1000
Reputation: 836
When you are adding your UIView to the UIWindow, you should change the UIViews size to not underlap the title bar. How to do this is well documented in this post:
Upvotes: 1
Reputation: 365
I hope i understood correctly, look in size inspector, ios 6/7 deltas. Check this link for an explanation: Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?
Upvotes: 0