推送视图控制器后,UINavigationBar颜色正在变化

时间:2018-03-07 06:13:36

标签: ios swift uinavigationcontroller uinavigationbar uinavigation

我遇到与导航栏颜色相关的有线问题。请查看以下图片。

图片1

enter image description here

图片2

enter image description here

图像1是家庭视图控制器,图像2是我推动家庭视图控制器的第二个视图控制器。

AppDelegate.swift我设置了以下内容......

UINavigationBar.appearance().backgroundColor = UIColor.clear
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().barTintColor = Color.red
UINavigationBar.appearance().shadowImage = UIImage();
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]

请观看,直到下面的图片结束,您将了解问题。我已经降低了动画速度,因此您可以了解它。

enter image description here

请帮我解决这个问题。任何帮助将不胜感激!!

提前谢谢。

1 个答案:

答案 0 :(得分:1)

取消选中UINavigationBar的半透明属性,如下所示 -

enter image description here

self.navigationController?.navigationBar.isTranslucent = false