Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the status bar programmatically in iOS 8 [duplicate]

Tags:

swift

ios8

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

like image 452
Jason Oviedo Avatar asked May 16 '15 02:05

Jason Oviedo


1 Answers

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

like image 129
tounaobun Avatar answered Nov 15 '22 11:11

tounaobun