Ios 导航栏着色颜色更改
我有一个设置了色调颜色的导航栏,但当我导航到其他屏幕时,它看起来与上一个屏幕有点不同..知道为什么会这样吗..如何修复此问题将此代码添加到Ios 导航栏着色颜色更改,ios,swift,uinavigationbar,tintcolor,Ios,Swift,Uinavigationbar,Tintcolor,我有一个设置了色调颜色的导航栏,但当我导航到其他屏幕时,它看起来与上一个屏幕有点不同..知道为什么会这样吗..如何修复此问题将此代码添加到rootViewController [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]}]; override func viewWillAppear(_ animated:
rootViewController
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];
override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.barStyle = UIBarStyle.default
navigationController?.navigationBar.tintColor = UIColor.black
}
如果对项目中的所有ViewController使用相同的导航控制器,则需要在AppDelegate中设置色调颜色
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UINavigationBar.appearance().barTintColor = colorToSet
// colorToSet is an object of UIColor
return true
}
在故事板中选择导航栏并更改栏的颜色 在带有红色标记的图像显示中
检查该特定视图控制器上的导航控制器的色调是否有任何变化。其他视图控制器的背景是否较亮?添加导航栏颜色变化代码。如果可能的话,附上两个屏幕的图像