0

I know I can change the iPhone's status bar text color, using methods described here.

However, my app has different themes, and I need to update the status bar accordingly.

Calling

[self setNeedsStatusBarAppearanceUpdate];

and

-(UIStatusBarStyle)preferredStatusBarStyle{ 
    return UIStatusBarStyleLightContent; 
}

will obviously not work. However, it needs to be local, as in only for a specific TabBar view.

Community
  • 1
  • 1
user3607973
  • 325
  • 3
  • 14

2 Answers2

1

First, select your Project and in the Genernal tab you will see something like this.

enter image description here

Then set Status Bar Style to Light just like the image.

Second, set View controller-based status bar appearance equal to NO in Info.plist. If you can't find it, just add a new row and set it like the above step.

And then, run your app you will see the Status bar text colour is white. :)

0

Just for the ones who come here for the title. You can set a flag and toggle between the status bar text colors like in the code segment given:

-(UIStatusBarStyle)preferredStatusBarStyle {

if (barStyleLight){

    return UIStatusBarStyleLightContent;
}
else {

    return UIStatusBarStyleDefault;
}

}

Also note that, this preferredStatusBarStyle method is called whenever we call: [self setNeedsStatusBarAppearanceUpdate];

Hope it helps.