Status bar becomes black

2.5k views Asked by At

I have a status bar with style UIStatusBarStyleLightContent(white text). But when the Application is sent to background, in the task manager, the status bar is shown with black text and it stays black until the application is fully in foreground again (it is black through the whole go to front animation).

I observed this behavior only in iPhone 6 and iPhone 6+ (simulator and actual device). It shows up white (as expected) on iPhone 4s, 5 and 5s (tested on simulator)

2

There are 2 answers

0
Daniel On BEST ANSWER

I just found a solution. It is a bug which gets solved if the proper splash screens are defined.

0
Aamir On

Try following steps, should be working in iOS 8+ as well.

1) Add property View controller-based status bar appearance => NO in Info.plist.
2) Add following piece of code in AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    [self.window setBackgroundColor:[UIColor redColor]]; // Change color as per need.

    return YES;
}

3) Override method in ViewController or you can consider overriding in ParentViewController of all ViewController if you have such Inheritance hierarchy. Otherwise you have to override this method in every ViewController.

- (UIStatusBarStyle) preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}