如何在iOS 6中禁用带有自定义背景图像的导航栏的导航栏阴影? [英] How do I disable the navigation bar shadow in iOS 6 for navigation bars with custom background images?
本文介绍了如何在iOS 6中禁用带有自定义背景图像的导航栏的导航栏阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在iOS 6中,即使您设置自定义背景图像,也会自动将阴影添加到导航栏。我很确定这不是iOS 5的情况,因为当我在iOS 5和6 sim中测试相同的代码时,阴影出现在iOS 6但不是5。
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?
推荐答案
将其放入AppDelegate
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!
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
这篇关于如何在iOS 6中禁用带有自定义背景图像的导航栏的导航栏阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文