gpt4 book ai didi

ios - 导航栏背景色-半透明为无

转载 作者:可可西里 更新时间:2023-11-01 04:08:53 25 4
gpt4 key购买 nike

我想将导航栏的背景颜色更改为纯绿色。

规则:我不能乱用 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。接受最早的答案。

最佳答案

在您的 viewController didLoad 方法中使用这行代码

self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:29.0f/255.0f green:149.0f/255.0f blue:174.0f/255.0f alpha:1.0f] 

关于ios - 导航栏背景色-半透明为无,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19094710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com