views:

50

answers:

2

hi, i am using a tab bar in a view controller and in "viewDidLoad" method i declare it:

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

and the viewControllers that are putted in the tabBar i write this to init them:

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

the problem that the title of the tabBarItem didn't appear for me ,so my question where is my mistake in all of this?

A: 

Use

self.title = @"signe astral";

to set the title of the ViewController, not on self.tabBarItem.

Eiko
A: 

Hi dingua,

Just you have to decalre in,

   self.title = @"signe astral"; 

If you want title and images in your tab bar. So you have to use this code.

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

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

Thanks.

Pugal Devan