It seems in iOS 6, a drop shadow is automatically added to the navigation bar even when you set a custom background image. I'm pretty sure this wasn't the case with iOS 5 as when I test the same code in the iOS 5 and 6 sim, the shadow appears in iOS 6 but not 5.
Does anyone know anything about this? Or how to enable/disable it?
How about the alternative way:
UINavigationBar.appearance().barStyle = .Black
For the dark navigation bars iOS doesn't show the shadow.
There are two possible solutions, the second of which is mentioned in other answers.
Implement the following code:
Source: Advanced Appearance Customization on iOS, @27:15
I had the same problem and I've solved it by following:
Also you can try this:
controller is a UINavigationController.
Place this in your AppDelegate
This is what did it for me. Hope it helps!
Swift version with updates from comments
General, non-NDA-infringing answer:
If you don't want something sticking out of a layer, mask the layer to its bounds.
Set the height explicitly to 44 (or 32 for landscape on iPhone) if that doesn't work on its own.