我有5个UIBarButtonItems,只会改变2的颜色。 我怎么能在xcode 5中做到这一点?
非常感谢您的回答!
我必须在AppDelegate.m中添加到此代码中吗?
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB (0x34AADC)];
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleLightContent];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UIToolbar appearance] setBarTintColor:UIColorFromRGB (0x34AADC)];
答案 0 :(得分:1)
还有一种方法如下:
[[UIBarButtonItem appearanceWhenContainedIn:[<The class in which you want to set custom color> class], nil] setTintColor:<myColor>];
答案 1 :(得分:0)
你在某处为这些创建了一个对象。例如:
UINavigationController *navController=[[UINavigationController alloc]init];
现在你应该这样做:
[navController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
不要设置整个UINavigationController,设置对象。