1

ビューコントローラでタブバーを使用しており、「viewDidLoad」メソッドで次のように宣言しています。

    normalView =[[NormalViewController alloc] initWithSigne:[[normalAstro objectAtIndex:signIndex]objectForKey :@"name"] andDescription:[[normalAstro objectAtIndex:signIndex]objectForKey :@"description"]] ;

[controllers addObject:normalView];
chineseIndex=[self searchChineseIndex];
chineseView =[[ChineseViewController alloc] initWithSigne:[[chineseAstro objectAtIndex:chineseIndex]objectForKey :@"name"] andDescription:[[chineseAstro objectAtIndex:chineseIndex]objectForKey :@"description"]] ;


[controllers addObject:chineseView];

tabBar = [[UITabBarController alloc] init];
tabBar.viewControllers=controllers;

[self.view addSubview:tabBar.view ];

そして、tabBarに配置されたviewControllersは、それらを初期化するためにこれを記述します。

[self.tabBarItem setTitle:@"signe astral" ] ;

tabBarItemのタイトルが表示されないという問題があります。それで、私の質問は、これらすべての間違いはどこにあるのでしょうか。

4

2 に答える 2

0

使用する

self.title = @"signe astral";

on ではなく、UIViewController のタイトルを設定しself.tabBarItemます。

于 2010-06-10T13:51:39.627 に答える
0

デカールを貼るだけで、

   self.title = @"signe astral"; 

タブバーにタイトルと画像が必要な場合。したがって、このコードを使用する必要があります。

     UIImage *img = [UIImage imageNamed:@"sss.png"];

     self.tabBar = [[[UITabBarItem alloc] initWithTitle:@"signe astral" image:img tag:1] autorelease];

ありがとう。

于 2010-06-10T15:13:39.467 に答える