I have a UINavigationController in my AppDelegate with a RootViewController that has a UITableView. On startup, the status bar changes its color to the color of the navigation bar. When I colored my navigation bar to orange, this is what the status bar is looking like:
It seems that my navigation bar is shifted to the top a little bit. It appears that the navigation controller does not recognize the status bar. How can I fix this issue?
The only thing I have in my app is an AppDelegate and an empty RootViewController. My application:didFinishLaunchingWithOptions
is:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
[navigationController.navigationBar setTintColor:[UIColor orangeColor]];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
My IB file for RootViewController just has an empty view.
Nothing unusual. I'm pretty experienced with iOS and that's how I've been doing it every single time. I have no idea what is different this time.
Could someone please advise me? Thanks
Add this code:
This will make your status bar black again.
You should add it after changing the color of your navigation bar.
In iOS 6.0 the status bar changes color to match the navigation bar, if there is one. This is expected behavior.
Set your status-bar-style towards
UIStatusBarStyleBlackOpaque
and you should get a solid black bar.To do that, use
setStatusBarStyle:animated:
on your applications' instance: