6

I am having a problem getting the status bar to show up in my view on iOS. I have tried changing the plist file of "Status Bar is Initially Hidden" to NO but it still doesn't show up.This black bar is all I get and I am unsure why. enter image description here

EDIT: I am unsure why i got down voted, I did research this and everything I've tried has not worked, maybe i should be more specific. Ive tried both the answers below, resulting in an error. Is there something i am missing with delegation or something similar. I am new to swift and have issues with delegations.

Community
  • 1
  • 1
Dallas
  • 1,718
  • 2
  • 12
  • 22

2 Answers2

6

One other thing you can try is to click on the name of your project. Then click on the name of your project under Targets. Then under where it says Deployment Info take a look at where it says Status Bar Style and change it to Light. Do a Shift+Cmd+K to clean and then run.

jasonnoahchoi
  • 863
  • 5
  • 16
  • This worked! Thank you so much. It was on "Default" I am unsure why the default for my program was turned off. – Dallas Jan 17 '16 at 04:59
  • SHIFT-CMD-K to clean – Mark Nov 25 '16 at 02:38
  • you just made my day ++ – Khodour.F Aug 22 '17 at 13:03
  • Default does not mean it was hidden. The default style for the status bar is dark text on a light background. Your status bar is there, but you can't see it because the black text is on top of a black background. Changing the setting to light content made it show up because now the status bar text is white. – Steve Madsen Jun 07 '19 at 21:12
2

The perfect and working way to make StatusBar LightContent.

1) Go to "info.plist" and add property View controller-based status bar appearance = NO

2) In your AppDelgate.swift, put this code:

application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)

Hope this helps!

UPDATE : for iOS 9, Swift 4 :

UIApplication.shared.statusBarStyle = .lightContent
byJeevan
  • 3,528
  • 3
  • 35
  • 57
Sohil R. Memon
  • 9,176
  • 1
  • 30
  • 56