[英]change color of custom uibarbuttonitem (iOS7)
我有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)];
還有一種方法如下:
[[UIBarButtonItem appearanceWhenContainedIn:[<The class in which you want to set custom color> class], nil] setTintColor:<myColor>];
您在某個地方為此創建了一個對象。 例如:
UINavigationController *navController=[[UINavigationController alloc]init];
現在您應該執行以下操作:
[navController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
不要設置整個UINavigationController,而是設置對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.