I have picture examples to show you what I want and what I have right now.
First, here is an example of what I'm trying to do, from the Slack app:
The statusbar is normally displayed:
But when you open the side drawer, it goes away:
I can display the status bar in my app:
But when I hide it, it also hides the frame, so there is less space at the top than before:
It looks wonky to remove space from the top whenever the side drawer opens, but it also looks bad to not hide the status bar since the menu has a different background color. How can I hide the text on the status bar while keeping the space for it still there?
I couldn't get the accepted answer to work on iOS 10 in Swift 3. So here is what I came up with:
I think you want something like the following (In Swift, Deploy target is 9.0):
To hide it:
To show it again:
I'm not sure you will run into the same issue as I will, but when I tested the code I originally didn't have that "-0.00001" and the transition was not smooth but that little subtraction fixed it. Not sure why.
I did succeed with this solution.