2012-04-20 7 views
1

iOSでプログラムでUITabBarItemを追加したいと思います。インターフェイスビルダーでプログラムでUITabBarItemの識別子タイプをiOSに追加する方法はありますか?

、我々は簡単に...など、検索、お気に入り、最近のタブのための識別子で

を選択することができます私は私はプログラム的にこれらの識別子のタイプを追加する方法を知っていただきたいと思いますか?

答えて

4

これをUIViewControllerのプロパティとして追加しますか? TabBarの画像の巨大なパックhttp://www.axialis.com/objects/ip_icon_09.shtml

+0

はい、カスタム画像にすることができます –

+0

1つのViewControllerに2番目のBarButtonを追加するにはどうすればよいですか? –

+0

セカンドバーボタンとは何ですか?2番目のタブですか? –

3
UITabBarItem *barItem = [[UITabBarItem] alloc] initWithTabBarSystemItem:UITabBarSystemItemMore tag:0]; 
self.tabBarItem = [barItem autorelease]; //of not using ARC 

で事前に定義されたシステムバー項目があるあなたがUITabBarItem

UITabBarItem *localTabBarItem = [[UITabBarItem alloc]                     initWithTitle:@"Date" image:clockIcon tag:0];

を作成してからのUIViewControllerのプロパティはここ

[viewController setTabBarItem:localTabBarItem]; 

を設定します。

UITabBarSystemItemMore, 
UITabBarSystemItemFavorites, 
UITabBarSystemItemFeatured, 
UITabBarSystemItemTopRated, 
UITabBarSystemItemRecents, 
UITabBarSystemItemContacts, 
UITabBarSystemItemHistory, 
UITabBarSystemItemBookmarks, 
UITabBarSystemItemSearch, 
UITabBarSystemItemDownloads, 
UITabBarSystemItemMostRecent, 
UITabBarSystemItemMostViewed 
+0

ご協力いただきありがとうございます。 :) –

関連する問題