Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't resize navigation bar when hiding status bar

Tags:

ios

swift

I'm building a application with Swift + AVPlayer and have set "View controller-based status bar appearance" to "YES". The problem with this is that when I launch the player from my UITableViewController/UINavigationController the nav bar hides the status bar automatically and the nav bar is resized.

You can see what I mean here:

http://quick.as/eOXLiv45x

enter image description here

Is there any way to prevent this?

Cheers!

like image 964
Stephen Radford Avatar asked May 24 '15 11:05

Stephen Radford


People also ask

How do I hide and show Navigation bar?

Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

What is Navigation bar on Android?

The Navigation bar is the menu that appears on the bottom of your screen - it's the foundation of navigating your phone. However, it isn't set in stone; you can customize the layout and button order, or even make it disappear entirely and use gestures to navigate your phone instead.

How do I hide the Navigation bar in Android 12?

Step 10: search “android:dimen/navigation_bar_frame_height” in the search bar and set it to 0. Hit apply and save it and ensure the tick mark. And your Navigation gesture pill will disappear and you will have an uninterrupted Android experience tailored to perfection just by you.


1 Answers

Okay, so this was the solution I used in the end.

  1. Set "View controller-based status bar appearance" to "NO"
  2. Override the following functions in the media view controller
override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)
    UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Fade)
}

override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(animated)
    UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: .Fade)
}
like image 60
Stephen Radford Avatar answered Jan 03 '23 14:01

Stephen Radford