lukech lukech - 1 year ago 85
Objective-C Question

Change iOS7 Status Bar Colour programmatically, mid-run?

I’m trying to change the Status Bar colour mid-run, i.e. not when a controller is loaded. I change the view’s background colour, so I need to change it from the black to white and vice versa.

I know that I can change it using

and the setting in the plist, but as far as I can see that’ll only set it on first launching the view controller. I’d like to change it, for instance, when I hit a button.

Can I do that?

Answer Source
  • Go to your application Plist and add this as new row & set it as NO.

    View controller-based status bar appearance  NO

Add a bool to determine state of UIStatusBar colour & add a Toggle method

@property(nonatomic) BOOL black;


    if(black) {
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
        black = NO;

    }else {
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
        black = YES;

here is a Sample ScreenShot

  • When Menu is Closed, the colour is White.

    enter image description here

  • When Menu is Open The colour is Black

    enter image description here

Hope that helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download