我在我的AppDelegate中使用didFinishLaunchingWithOptions
方法添加了此代码:
[[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没有改变它们的颜色。我做错了什么? 感谢
答案 0 :(得分: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]];