如何移除导航栏模糊效果 - Swift

3
我在互联网上搜索了很多,但没有找到任何解决问题的方法。 我不希望导航栏像截图enter image description here中一样模糊。
导航栏的颜色与其他颜色不匹配,即使我已经使用了相同的十六进制值。 我想修复它,请帮忙。
这是我用来着色导航栏的代码。
 let navigationBarAppearace = UINavigationBar.appearance()
    navigationBarAppearace.tintColor = UIColor.white
    navigationBarAppearace.barTintColor = UIColor(red: 204/255.0, green: 51/255.0, blue: 51/255.0, alpha: 1.0)
3个回答

4
你看到的并不是实际的“模糊效果”,而是UINavigationBar的半透明样式。如果你不想要半透明的栏,将其isTranslucent属性设置为false即可。
UINavigationBar.appearance().isTranslucent = false

1
您可以通过设置标准和滚动边缘来禁用此模糊效果。
       **Standard Appearance 
                background-color**
                This setting will Work to hide the blur effect on a scroll and also to set title style on scroll

       **Scroll Edge Appearance
                background-color**

                Appearance without scroll-like background color, title, etc.

其他设置保持不变,例如透明:true等。

在此输入图片描述


1

用法:

navigationController.navigationBar.isTranslucent = false


将导航栏设置为不透明。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接