0

I'm trying to get the status bar to be black for my app since it would look a lot better with my content.

Everything I've been reading is I would need:

UIView* loadingView;
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNeedsStatusBarAppearanceUpdate];
}

and

-(UIStatusBarStyle) preferredStatusBarStyle
{

    return UIStatusBarStyleBlackOpaque;
}

But this results in an entirely white status bar with no text or battery indicator. Possibly because its depreciated? How do I achieve this in iOS 9+?

theshadow124
  • 661
  • 3
  • 8
  • 29
  • You might wanna check this question and its answers: http://stackoverflow.com/questions/18294872/ios-7-status-bar-back-to-ios-6-default-style-in-iphone-app – Nicolas Miari May 20 '16 at 01:51

1 Answers1

2

The status bar is transparent in iOS 9.

But this results in an entirely white status bar with no text or battery indicator

No it doesn't. It results in a transparent status bar containing white text and battery indicator — and you can't see that, because (as I just said) the status bar is transparent, and what's behind the status bar is also white.

I'm trying to get the status bar to be black for my app

You can't. The status bar is transparent (as I believe I've mentioned). If you want it to seem black, put a black view behind it.

In other words, the black region behind the status bar, which you think will look good with your content, will need to be part of your content.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Great, I set my view's background to black but now the text and battery indicator are invisible. – theshadow124 May 20 '16 at 01:55
  • Well, obviously then you _also_ need to ask for light status bar content to contrast with it. – matt May 20 '16 at 01:59
  • Ill try that in code then, was requesting it in my project properties. – theshadow124 May 20 '16 at 02:00
  • Right, there's no such project property. Each view controller must dictate the status bar appearance by implementing `preferredStatusBarStyle`. – matt May 20 '16 at 02:01