Setting the background color of UINavigationBar has no effect?

家住魔仙堡 提交于 2019-12-08 01:36:56

问题


For most iOS widgets I can set the background color. It appears that UINavigationBar is not this way. Furthermore I cannot set the navigation item (top item)'s background as it does not respond to setBackgroundColor.

How can I change that color? Thanks.


回答1:


You should use setTintColor: instead:

[self.navigationController.navigationBar setTintColor:[UIColor redColor]];

Hope this helps!




回答2:


Change it by following code:

self.navigationController.navigationBar.tintColor=[UIColor grayColor];



回答3:


Easiest way would be to use the Interface Builder:



来源:https://stackoverflow.com/questions/7448020/setting-the-background-color-of-uinavigationbar-has-no-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!