6

TabBarControllerのアイテムのタイトルとアイコンを変更するにはどうすればよいですか?Interface Builderで直接可能ですか?

4

1 に答える 1

13

コードで:

UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Fancy Tab" image:[UIImage imageNamed:@"FancyTab"] tag:1];
myViewController.tabBarItem = tabBarItem; // to set the tabBarItem from outside the viewController
self.tabBarItem = tabBarItem;             // to set the tabBarItem from inside the viewController

通常の.xibの場合:tabBarControllerの項目をクリックします。そして、もう一度クリックします。属性インスペクターでタイトルとアイコンを編集できるようになりました。

ストーリーボード内:(tabBarController自体ではなく)tabBarControllerに接続されているviewController内のアイテムをクリックします。今回はワンクリックで十分です。そして、属性インスペクターでタイトルとアイコンを設定します。

ここに画像の説明を入力してください

于 2012-03-17T09:22:44.830 に答える