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";

设置 UIViewController 的标题,而不是self.tabBarItem.

于 2010-06-10T13:51:39.627 回答
0

只是你必须在decal,

   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 回答