2
votes

In one view I am hiding the navigation bar using:

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    self.navigationController?.navigationBarHidden = true
    }

This makes the status bar background color appear as white. But how do I change the background color of the status bar?

2
I think you should change your view's or root window's background color as I suspect that your status bar is transparent.Ozgur Vatansever
@ozgur My status bar is red, with white text, or it used to be. But the root view has red background color and white textuser2722667
@ozgur If I set the background color of the viewcontrollers root view to eg red. It looks fine. But since I have an scroll view and then scroll to the bottom it will show a red background color at the bottom as well. When you scroll to the end and keep dragging, that bounce effect will show a red coloruser2722667
The status bar doesn't have a background color any more... does it?nhgrif
status bar can have only two styles, default (which is black) and light content. - rshankar.com/how-to-customize-status-bar-in-iosrshankar

2 Answers

0
votes

You can have a light color and dark color for your status bar

 UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: true)

(or)

  UIApplication.sharedApplication().setStatusBarStyle(.Default, animated: true)
0
votes

You can change the status bar styles by setting a key "Status Bar Style" in the info.plist.

The following three different styles are present for status bars:- Status bar style - String

  1. Gray style (default)
  2. Transparent black style (alpha of 0.5)
  3. Opaque black style

enter image description here

You can also change the setting from all view controllers to view controller based status bar, by changing the following key in the info.plist:-

View controller-based status bar appearance - Boolean

  1. Yes
  2. No

enter image description here