简体   繁体   English

获取视图的导航栏颜色不起作用

[英]Getting Navigation Bar Color For View is Not Working

I have getting navigation bar color and set it to view as background color but it's not as same as the color in bar. 我有导航栏颜色并将其设置为背景颜色,但它与栏中的颜色不同。 I don't know why it's doing so. 我不知道为什么要这么做。 Your solutions are welcome and i hope you help me in that matter. 我们欢迎您提出解决方案,希望您能在此问题上为我提供帮助。

CODE

     self.navigationController.navigationBar.tintColor = [UIColor blueColor]
     UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,20,20)];
     view.backgroundColor=  self.navigationController.navigationBar.tintColor;

In my application design we have same theme that's why it's not getting the theme of navigation view background color there is some difference. 在我的应用程序设计中,我们拥有相同的主题,这就是为什么它没有获得导航视图背景色的主题存在某些差异的原因。

Use -[UINavigationBar barTintColor] property instead of tintColor PS. 使用-[UINavigationBar barTintColor]属性而不是tintColor PS。 Be aware of translucency :) 注意半透明:)

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

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