I am trying to hide the statusbar but maintain the \"bigger\" navigationbar height. Right now when I hide the statusbar by setting - (BOOL)prefersStatusBarHidden
to
Add this code in your view Controller:
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
I had to do this once. I ended up creating a custom navigationBar of my own and then just set the frame as:
navBar.frame=CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height);
It worked for me at the time. Just try it out.
You should use of positionForBar: method of UIBarPositioningDelegate Protocol.
I don't want to put another answer or copy/past so you should take closer look at following question\answers. :)
iOS 7 Status Bar Collides With NavigationBar
iOS 7 UIToolBar Overriding With Status Bar
statusbar overlapping content in iOS7
Another workaround here: subclass UINavigationController
override method:
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
if (self.navigationBar.frameMinY < 1) {
self.navigationBar.frameHeight = 64;
} else {
self.navigationBar.frameHeight = 44;
}
}
in which set frameMinY
is set frame.origin.y
and set frameHeight
is set frame.size.height
You can create a custom UIView with its frame as
customView.frame=CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height);
Also hide your status bar by following the below steps
Go to info.plist and add two attributes if not present. set "Status bar is initially hidden" to YES
and set UIViewControllerBasedStatusBarAppearance
to NO
. This will hide status bar for your app.