How to hide the status bar programmatically in iOS 8

12,515

You should add this key/value pair to your project's Info.plist.

<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

enter image description here

After that,calling

UIApplication.sharedApplication().statusBarHidden = true

or

UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Fade) // with animation option.

This post gives more details > How to hide iOS status bar

Share:
12,515
Jason Oviedo
Author by

Jason Oviedo

Updated on June 04, 2022

Comments

  • Jason Oviedo
    Jason Oviedo almost 2 years

    Just like the question says, I need to hide status + navigation bar when user taps. So far, navigation bar was easy. Cann't find a way to do the same with status bar.

    By the way, tried

    UIApplication.sharedApplication().statusBarHidden = true
    

    but no luck yet

  • Oleg Popov
    Oleg Popov over 8 years
    i would like just to tell you Thanks!
  • Codetard
    Codetard about 8 years
    it's deprecated in iOS 9
  • Greg
    Greg about 8 years
    @SatnamSync if you look at the date this answer was posted, you'll notice that iOS 9 was not yet released at that time. If you have a better answer, please feel free to answer this question yourself.