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

I've tried both the answers below, resulting in an error. Is there something I am missing with delegation or something similar?

E_net4
  • 27,810
  • 13
  • 101
  • 139
Dallas
  • 1,788
  • 2
  • 13
  • 24

3 Answers3

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
  • 871
  • 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
  • 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,728
  • 3
  • 37
  • 60
Sohil R. Memon
  • 9,404
  • 1
  • 31
  • 57
0

Straight from the docs:link to docs

For a single status bar style throughout your app:

add View controller-based status bar appearance in your Info.plist.

set View controller-based status bar appearance to NO

set Status bar style to Light content or whatever you want

This status bar wont be affected by the dark or light mode you set in your device's settings.

Boris Gafurov
  • 1,427
  • 16
  • 28