Objective c 导航栏一直变为灰色,尽管它变为白色。为什么?

Objective c 导航栏一直变为灰色,尽管它变为白色。为什么?,objective-c,uinavigationcontroller,uinavigationbar,uicolor,Objective C,Uinavigationcontroller,Uinavigationbar,Uicolor,我用这个代码把导航栏上的“后退”按钮变成白色,但它一直把它变成灰色 [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; 我也试过: [[UINavigationBar appearance] setTintColor:UIColorFromRGB(0xFFFFFF)]; 我也尝试过(我在另一个问题中发现): 他们都不工作!他们一直把它变成灰色!如果我尝试红色/黑色/绿色或其他颜色,它们会起作用,但白色会不断变为灰

我用这个代码把导航栏上的“后退”按钮变成白色,但它一直把它变成灰色

[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
我也试过:

[[UINavigationBar appearance] setTintColor:UIColorFromRGB(0xFFFFFF)];
我也尝试过(我在另一个问题中发现):

他们都不工作!他们一直把它变成灰色!如果我尝试红色/黑色/绿色或其他颜色,它们会起作用,但白色会不断变为灰色。

像这样尝试

UINavigationController *controller= [[UINavigationController alloc]     
initWithRootViewController:YourViewController];
controller.navigationBar.tintColor = [UIColor whiteColor];

你把它放在你的应用程序代理中了吗?@jeevantandi它就在那里它告诉我rootController没有声明。rootController是你的第一个视图控制器的实例。我怎么知道它的名字?我已经转到我的故事板并放置了视图控制器的名称,但它们不起作用。还是我看错了位置?我刚刚意识到,您是在尝试更改后退按钮的颜色还是导航栏的颜色?您是否尝试过在.storyboard文件中更改它
UINavigationController *controller= [[UINavigationController alloc]     
initWithRootViewController:YourViewController];
controller.navigationBar.tintColor = [UIColor whiteColor];