How do I disable the navigation bar shadow in iOS 6 for navigation bars with custom background images?

前端 未结 13 1478
后悔当初
后悔当初 2020-12-12 17:10

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

13条回答
  •  感情败类
    2020-12-12 17:40

    Place this in your AppDelegate

    [[UINavigationBar appearance] setShadowImage:[UIImage new]];
    // is IOS 7 and later
    [[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    

    This is what did it for me. Hope it helps!

    Swift version with updates from comments

        UINavigationBar.appearance().shadowImage = UIImage()
        UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
    

提交回复
热议问题