0

I have the following code to change the color of my status bar and it is working fine.

statusBarTintView = [[UIView alloc] initWithFrame:[[UIApplication sharedApplication] statusBarFrame]];
statusBarTintView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
statusBarTintView.backgroundColor = [[Color sharedInstance] navigationBarColor];
[self.window addSubview:statusBarTintView];
[statusBarTintView release];

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

But it is taking a lot of time to change (only for the first time). What am i doing wrong? Can anyone help me?

sudarshan
  • 122
  • 8

1 Answers1

0
  1. Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file.
  2. In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate];
  3. Add the following method:

    - (UIStatusBarStyle) preferredStatusBarStyle
    { 
         return UIStatusBarStyleLightContent; 
    }
    

Please refer this answers for more details.

How to change Status Bar text color in iOS 7

Change status bar text color to light in iOS 9 with Objective C

Community
  • 1
  • 1
asim.temur
  • 61
  • 6