简体   繁体   English

导航栏颜色和视图的颜色

[英]Navigation Bar color and a View's color

I'm getting a weird, i have a navigation bar and a view that is right under it. 我变得很奇怪,我有一个导航栏和一个在它下面的视图。

I set both of them to [UIColor BlueColor], but at run time the outcome is that the nav bar has a slit darker color then the view. 我将它们都设置为[UIColor BlueColor],但是在运行时,结果是导航栏的颜色比视图的颜色暗。

Any knows what causes this? 任何人都知道是什么原因造成的吗? Thanks 谢谢

Your problem is that the navigation bar is translucent, and therefore the bar color is put on top of the view's color, making it appear darker. 您的问题是导航栏是半透明的,因此导航条的颜色位于视图颜色的顶部,从而使其显得更暗。 Try making the bar not translucent. 尝试使栏不透明。

navigationBar.translucent = NO;

You can try this one:-- 您可以尝试以下方法:-

navigationController.navigationBar.barTintColor = [UIColor greenColor];

or 要么

[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM