The Cook The Cook - 12 days ago 7
Swift Question

Presented View Controller Status Bar Color is Different, How to Change It To Default?

I have a presented view controller. However its status bar color is different then its navigation bar color. How do I make sure they are same color?

Answer

Try below code, if it help:

Set same style as current viewController to viewController being presented as follows:

//newViewController is your ViewController

newViewController.navigationBar.barStyle = self.navigationController.navigationBar.barStyle;

[self presentViewController:newViewController animated:YES completion:nil];

Also, If you are using a navigation controller and want to control the status bar on a per view controller basis, you'll want to subclass UINavigationController and implement preferredStatusBarStyle.

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return self.topViewController.preferredStatusBarStyle;
}

OR

- (UIStatusBarStyle)preferredStatusBarStyle {

    return UIStatusBarStyleLightContent;
}
Comments