Sam D20
Sam D20

Reputation: 2575

Why isn't the status bar adjusting the color of its text to match my UINavigationController?

I have an app that uses a navigation bar with a dark gray background color and a white title. According to this article, under "UINavigationController and the iOS7 Status Bar", it says that it should that as long as I am using a navigation controller, the status bar should automatically adjust its text color to match it. Here is a screenshot of the top of my app:

enter image description here

As you can see, the navigation controller's title was set to white, so shouldn't the status bar be set to white too? Here's my code for the navigation controller's color adjustment:

UINavigationController* navStack = [[UINavigationController alloc] initWithRootViewController:mainFeed];

navStack.navigationBar.barTintColor = [UIColor colorWithRed:20/255.0f green:20/255.0f blue:20/255.0f alpha:1.0f];
navStack.navigationBar.tintColor = [UIColor whiteColor];
[navStack.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; 

Upvotes: 1

Views: 613

Answers (1)

David Wong
David Wong

Reputation: 10294

You need to add this in:

navStack.navigationBar.barStyle = UIBarStyleBlack;

What that article says is a bit misleading.

Upvotes: 7

Related Questions