我想将导航栏的背景颜色更改为纯绿色。导航栏背景颜色 - 半透明不是
规则:我不能用的AppDelegate :)
我试过乱:
//It's green but it's translucent
[self.navigationController.navigationBar setBackgroundColor:[UIColor colorWithRed:77/255.0 green:255/255.0 blue:100/255.0 alpha:1.0f]];
//It's white, first line has no effect
[self.navigationController.navigationBar setBackgroundColor:[UIColor colorWithRed:77/255.0 green:255/255.0 blue:100/255.0 alpha:1.0f]];
[self.navigationController.navigationBar setTranslucent:NO];
//Same result as case 1
[self.navigationController.navigationBar setAlpha:0.0f];
[self.navigationController.navigationBar setBackgroundColor:[UIColor colorWithRed:77/255.0 green:255/255.0 blue:100/255.0 alpha:1.0f]];
//Too dark
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
[self.navigationController.navigationBar setBackgroundColor:[UIColor colorWithRed:77/255.0 green:255/255.0 blue:100/255.0 alpha:1.0f]];
//Only affects the back button's color:
[self.navigationController.navigationBar setTintColor:[UIColor greenColor]];
所以任何想法?
谢谢,没有看到有barTintColor和TintColor。接受最早的答案。
迪迪你用故事板?然后选择视图控制器,然后在模拟指标下的检查器中将顶部栏设置为不透明的导航栏 – thorb65