Search code examples
iosstatusbar

Status bar style issue


I need a Light content status bar for my iOS 8 app but it will show up as Dark. This thing persists and I can't get it work.

What I have tried so far:

  • Setting the Status bar style in the Info.plist
  • Setting the style through code with UIApplication
  • Trying to set the UINavigationBar
  • Setting the Status bar property for UIViewControllers

None of the above works, I get a Light content on the Loading Screen Storyboard but it gets dark as soon as it loads the starting UIViewController from the storyboard. Any thoughts why this is happening?


Solution

  • Put that code in your view controller

    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
        [self setNeedsStatusBarAppearanceUpdate];
    }
    
    - (UIStatusBarStyle)preferredStatusBarStyle {
        return UIStatusBarStyleLightContent;
    }