So I have a navigation controller for which I want the navigation bar to be transparent. I accomplish this with an extension on UINavigationController:
extension UINavigationController {
func setNavigationBarTransparent(transparent: Bool) {
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true
}
}
This works perfectly when the app opens, and when it presents another navigation controller which has its navigation bar hidden in the same way. However, only when the root navigation controller (the window's root view controller) pushes another view controller, a shadow appears behind the navigation bar and won't disappear until it presents another navigation controller. Where is this shadow coming from? And how can I get rid of it? Thanks in advance!