Question

My navigation bar colours appear normally in iOS 7

Deploying iOS 6.0, but if the system version is iOS 7.0 or later, some of the navigation bar colouring doesn't display properly on iPhone 4. Works fine in iPhone 5.

Here's how I am doing it:

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
    self.edgesForExtendedLayout = UIRectEdgeNone;
    [self.navigationController.navigationBar setBarTintColor:[UIColor blueColor]];
    [self.navigationController.navigationBar setTranslucent:YES];
}


#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

Maybe the last line is the problem (setTranslucent) since I have heard that iPhone 4 has some problems with the translucency, but I'm pretty sure that you could set the navbar to be translucent in iOS 6 as well. Will try getting rid of that out next and update if it fixes anything.

EDIT: Looks like the bar colour disappears after I dismiss a presented view controller. But it doesn't screw up on anything but the iPhone 4.

Was it helpful?

Solution

Get rid of [self.navigationController.navigationBar setTranslucent:YES]; and it should work fine.

If you want, you can check the device model (see here: Determine device (iPhone, iPod Touch) with iPhone SDK)

and adjust view accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top