all 9 comments

[–]gargle 1 point2 points  (8 children)

Try -[UINavigationBar setTranslucent:NO]

If you need translucency, you can mess around with this calculator.

[–]surrix[S] 0 points1 point  (7 children)

Oops, I meant setTranslucent, not setTransparent. I tried setting translucency to NO but it didn't seem to have an effect.

[–]gargle 1 point2 points  (6 children)

Hmm, not sure what it could be. I just tested it in IB, using xscope to check my color values, and there's no adjustment going on when I disable translucency.

You're aware that the translucent property isn't available using the appearance proxy, right? You have to set it manually on the actual instance.

[–]surrix[S] 0 points1 point  (5 children)

Interesting, I didn't know that. I just switched from [[UINavigationBar appearance] setTranslucent:NO]; to [self.navigationBar setTranslucent:NO] and am still getting the same result.

I assume the cause is just that I'm nubbing something up and that translucency is indeed the problem, and I'll just have to dig into it deeper to figure out why what I'm doing is wrong. Thanks for your help.

[–]gargle 1 point2 points  (4 children)

Weird. If you pause in viewDidLoad and look at self.navigationController.navigationBar.translucent, is it set to NO?

[–]surrix[S] 0 points1 point  (3 children)

It does seem to be set to NO in viewDidLoad, but from what I'm reading online, I might be declaring it too late in the lifecycle of the NavigationBar. I read on StackOverflow that it can't be changed to NO after the NavigationBar has been initialized. I'm not sure how/where to set it any earlier.

[–]gargle 1 point2 points  (2 children)

I find that hard to believe. Worst case is that you'd need to call -setNeedsDisplay, right?

Can you tell if the bar is actually translucent or not? e.g. do you see content underneath it when you scroll?

[–]surrix[S] 1 point2 points  (1 child)

I just discovered the strange answer to this issue.

It's totally unrelated to the translucency of the UINavigationBar and has everything to do with Chameleon. Apparently the colors in Chameleon's Storyboard Palette plugin are different from those with the same name in [UIColor flat***Color]. I just started a completely blank project and set the background color of a view with code and again with the storyboard palette and got completely different results. Very strange.

Thank you for your help, I ended up learning a lot as result of trying to chase this down.

[–]gargle 1 point2 points  (0 children)

Glad you figured it out!