Question

Recently I've updated my Xcode IDE to the latest to have iOS 7.1 SDK. For some reason, after recompiling my app with the new Xcode I get this wired UINavigationBar background colour.

I'm using storyboard to push the secondary view controller from home screen. The secondary view controller is a static table of settings, also built using storyboard, and contains the following code in its viewDidLoad method:

[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = nil;

I haven't done any other changes to this screen or any other screens in the app.

This is how it used to look like before:

enter image description here

This is how it is look like now:

enter image description here

Does anyone have any idea what could have caused this?

Cheers,

EDIT: @Leo Natan -

When I'm trying to set the color myself, for example, by replacing this line:

[self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];

with this line:

[self.navigationController.navigationBar setBackgroundColor:[UIColor redColor]];

I get this: the red color applied only on the header without the status bar, what can I do?

enter image description here

Was it helpful?

Solution

Latest Xcode comes with iOS7.1 SDK, in which Apple once again changed how the color is calculated. You will have to play again with your color to achieve a similar look in iOS7.1.

OTHER TIPS

Maybe you should take another approach. Use the Appearance Proxy in the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions. Thats how I do it:

//Navigationbar
[[UINavigationBar appearance] setBarTintColor:lightOrangeColor];
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"navbarAssets-backArrow-iOS7"]];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"navbarAssets-backArrow-iOS7"]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes: @{NSForegroundColorAttributeName : [UIColor whiteColor]}];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top