0

I want to be able to change the status bar color on a per view controller basis. My ViewController flow is A->B->C. The launch status bar color is black (in A), and I change it to white in view Controller B. I use the following in Bs viewDidLoad:

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
 [self setNeedsStatusBarAppearanceUpdate];

Which works perfectly. However when I go back to ViewController A, it is white also. I tried using the following code to change it back but it doesnt work:

 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
 [self setNeedsStatusBarAppearanceUpdate];

I also tried:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;

But its deprecated and doesnt work.

I have seen the other questions on SO about this, but they tell you how to change it but not change back to default.

Thanks in advance

DevC
  • 6,982
  • 9
  • 45
  • 80

1 Answers1

0

Setting the navigation bar back to default in viewWillAppear did the trick.

DevC
  • 6,982
  • 9
  • 45
  • 80