iosobjective-cios7-statusbar

Show and hide status bar + change status bar text color between view controllers in iOS


Yet another question about the iOS 7 status bar coloring and visibility... in my solution I want to have all these things:

I'm having trouble with the 'View controller based status bar appearance' plist setting; when NO, I'm able to show and hide the status bar, but not change the color; whereas when set to YES, it's vice versa.


Solution

  • with View controller based status bar appearance to NO in plist it would work.

    For example-> Lets say in viewcontroller1, i have below piece of code

    -(void)viewDidAppear:(BOOL)animated{
        [super viewDidAppear: animated];
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
    }
    

    And i push viewcontroller2 from viewcontroller1 which has below code

    -(void)viewDidAppear:(BOOL)animated{
        [super viewDidAppear: animated];
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
    }
    

    with above code when tested in simulator, it perfectly animated the changes.