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 YES
and then calling [self setNeedsStatusBarAppearanceUpdate];
. The problem with this is that the navigationbar will slide up and won't leave space for the notification I'm trying to show. Simply adding a view over the statusbar is not an option, our statusbar/navigation has the fancy blur effect. Does anyone have a clue how to maintain the standard navigationbar height with the status bar height and remove the statusbar from that?
Edit; what I ended up doing is taking a risk and getting the UIWindow of the statusbar via a private API and offsetting that.
Edit 2; App got approved with the private API. Be cautious though!
You can create a custom UIView with its frame as
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 setUIViewControllerBasedStatusBarAppearance
toNO
. This will hide status bar for your app.Add this code in your view Controller:
I had to do this once. I ended up creating a custom navigationBar of my own and then just set the frame as:
It worked for me at the time. Just try it out.
You should use of
positionForBar:
method ofUIBarPositioningDelegate 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:in which set
frameMinY
is setframe.origin.y
and setframeHeight
is setframe.size.height