问题
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