0

if the navigation bar style is UIBarStyleDefault, the status bar style will be UIStatusBarStyleDefault; if the navigation bar style is UIBarStyleBlack, the status bar style will be UIStatusBarStyleLightContent. In my project,navigation bar style is UIBarStyleBlack,but text in UIStatusBar still black.why?

Rerchard
  • 23
  • 4

2 Answers2

0

i think you missed to add

View controller-based status bar appearance == no

in your plist so by default it is taking black appearance for you status bar. make sure when you are adding it in your plist type should be Boolean.

Shubham bairagi
  • 943
  • 7
  • 25
0

in iOS 9 By default the status bar color is black color.So you need to do the below things.

If you use XIB,follow the below code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
   self.window setFrame:[[UIScreen mainScreen] bounds]];
   [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
   [application setStatusBarHidden:NO];
   self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
   UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
   [self.window setRootViewController:navController];
   [navController setNavigationBarHidden:YES];
   [self.window makeKeyAndVisible];

   return YES;
}

If you use StoryBoard,apply the below code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
  [application setStatusBarHidden:NO];
  return YES;
}

in your project-info.plist

View controller-based status bar appearance   Boolean   NO
Status bar is initially hidden                Boolean   NO
user3182143
  • 9,459
  • 3
  • 32
  • 39