2012-03-25 14 views
-1

私はApp Delegateでタブバーコントローラを実装しましたが、タブバーの空白の四角です。タイトルとイメージを変更したいと思っています。カスタムイメージだけでなく、Xcodeで実装されている "デフォルト"イメージ( "calculator"イメージ、 "search"イメージ)の使い方も知りたいです。タブバー項目のタイトルと色をプログラムで変更する

xibにタブバーがある場合は、タブバーの項目 - >属性インスペクタ - >識別子で確認できます。カスタム画像を使用しない場合はリストがあります。だから私のappDelegate.mコードがある:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after app launch 


    UIViewController *banksList = [[FailedBanksListViewController alloc] initWithNibName:@"FailedBanksListViewController" bundle:nil]; 
    UINavigationController *listNavigationController = [[UINavigationController alloc] initWithRootViewController:banksList]; 

    UIViewController *first = [[BIDViewController alloc] initWithNibName:@"BIDViewController" bundle:nil];  
    UIViewController *second = [[BIDDailyCount alloc] initWithNibName:@"BIDDailyCount" bundle:nil]; 

    self.tabBarController = [[UITabBarController alloc] init]; 
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:first,second,listNavigationController, nil]; 
    self.window.rootViewController = self.tabBarController; 
    [self.window makeKeyAndVisible];  


    return YES; 
} 

答えて

2

あなたはあなたの自己あなたのUITabBarItem Sを作成する必要があります。あなたに

はあなたのような何かができるappdelegate:

UIViewController *banksList = [[FailedBanksListViewController alloc] initWithNibName:@"FailedBanksListViewController" bundle:nil]; 
banksList.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:0]; 

リターン自己;

これを各タブのコントローラでカスタムイニシャライザに移動することをお勧めします。

+0

ありがとう、Jacob、助けて! – Necrosoft

+0

システム 'UITabBarSystemItemSearch' *は画像です。私はそれがあなたが望むものだと思った。 'banksList.title = @" List ";' –

+0

問題が解決しました。再度、感謝します! – Necrosoft

関連する問題