1

I have 6 view controllers. I'd like to set the status bar of my first view controller to black and then the other 5 to white. All view controllers are in a push stack.

I've tried to implement

[self setNeedsStatusBarAppearanceUpdate]

- (UIStatusBarStyle) preferredStatusBarStyle { 
return UIStatusBarStyleLightContent; 
}

That does not seem to work. I've also tried playing with the apps plist properties. Any ideas?

user3626407
  • 287
  • 1
  • 6
  • 15

3 Answers3

1

If you want to change Background colour of status bar then that's possible. you have to change UIWindow 's background colour to your preferred colour. try following

e.g.

[[UIApplication sharedApplication].delegate window].backgroundColor = [UIColor orangeColor];

and if you want to change text colour then just try

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Jasmin
  • 794
  • 7
  • 18
0

You have missed this settings in Plist

View controller-based status bar appearance to YES

enter image description here

0

Do the following things.

  1. View controller-based status bar appearance = NO in plist.
  2. The ViewController that you want to make white in ViewwillApper add

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
  3. The ViewController that you want to make Black in ViewwillApper add

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    
Sunny Shah
  • 12,990
  • 9
  • 50
  • 86