2013-02-05 59 views
2

在我的應用我想改變標籤欄控制器的顏色,如何指定自定義顏色在iOS6的標籤欄控制器LIK uinavigation吧?任何一個可以給我一些refrences?標籤欄控制器控制器改變顏色

+0

要應用定製的TabBar圖標的變化?如果是,那麼你需要創建自定義的TabBar。 – jamil

回答

-1

您可以使用此電話

tabbarController.tabBar.tintColor = [UIColor redColor]; 
-1

只改變的TabBar的顏色,你可以通過這個實現:

tabbarController.tabBar.tintColor = [UIColor redColor]; 

但是,對於更多的,你需要創建自定義的TabBar,可與做它喜歡的顏色的變化,定製的TabBar圖標變化等

希望,這將是對你有所幫助。

乾杯。

0

可以使用setTintColor選項描述

[tabbarController.tabBar setTintColor:[UIColor greenColor]]; 

,或者你可以設置背景圖片

[tabbarController.tabBar setBackgroundImage:[UIImage imageNamed:@"tab_bg.png"]; 

如果您TabBarController定義的int AppDelegate中,你可能需要額外的編碼來訪問它。

首先要設置背景圖片

[[[[(UITabBarController *)[[(AppDelegate *)[UIApplication sharedApplication].delegate window] rootViewController]tabBar]setBackgroundImage:[UIImage imageNamed:@"tab_bg.png"]]]]; 

其次設置tintcolor如果需要

[[[[(UITabBarController *)[[(AppDelegate *)[UIApplication sharedApplication].delegate window] rootViewController]tabBar]setTintColor:[UIColor redColor]]]]; 

不要忘記導入AppDelegate.h文件。對我來說(在iOS6的測試)工作

-1

做法是:

[[UITabBar appearance]setTintColor:[UIColor redColor]]; 
在方法 application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions AppDelegate.h文件

。試試這個,如果它仍然是實際的。我看到這個問題仍然沒有解決。

2

把這個應用程序的委託:

UITabBarController *tabBarController = (UITabBarController *) self.window.rootViewController; 
tabBarController.view.tintColor = [UIColor redColor]; 

它比第一個答案更好,因爲它也改變了編輯視圖色調的顏色。