5

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

Greg
  • 9,068
  • 6
  • 49
  • 91
Jason Oviedo
  • 459
  • 1
  • 5
  • 16

2 Answers2

23

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

Community
  • 1
  • 1
tounaobun
  • 14,570
  • 9
  • 53
  • 75
0

This should do the trick:

UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: UIStatusBarAnimation.Slide)

See this answer for more details.

Community
  • 1
  • 1
Greg
  • 9,068
  • 6
  • 49
  • 91
  • 3
    it's deprecated in iOS 9 – Codetard Mar 06 '16 at 07:47
  • @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. – Greg Mar 06 '16 at 10:15