0

我在我的 AppDelegatedidFinishLaunchingWithOptions方法中添加了这段代码:

[[UINavigationBar appearance]setBackgroundColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];

[[UITabBar appearance] setBackgroundColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];

但是 NavigationBar 和 TabBar 没有改变它们的颜色。我做错了什么?谢谢

4

1 回答 1

1

使用setTintColor:而不是 setBackgroundColor:

[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];
于 2012-01-10T19:29:47.267 回答