我在TabBarApplication中有以下标签。我从我的主页导航到此TabBar。
UIViewController *viewController1 = [[ExpenseRecorderViewController alloc] initWithNibName:@"ExpenseRecorderViewController" bundle:nil];
UIViewController *viewController2 = [[TaxCalculatorViewController alloc] initWithNibName:@"TaxCalculatorViewController" bundle:nil];
UIViewController *viewController3 = [[CurrencyConverterViewController alloc] initWithNibName:@"CurrencyConverterViewController" bundle:nil];
UIViewController *viewController4 = [[emiCalculatorViewController alloc] initWithNibName:@"emiCalculatorViewController" bundle:nil];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,viewController3, viewController4, nil];
现在,如果我尝试通过类似的方式设置这四个标签的标题 -
[[tabBarController.tabBar.items objectAtIndex:0] setTitle:@"title A"];
[[tabBarController.tabBar.items objectAtIndex:1] setTitle:@"title B"];
[[tabBarController.tabBar.items objectAtIndex:2] setTitle:@"title C"];
然后它不起作用。我想我需要在顶部设置导航栏的标题。但是怎么做呢?
答案 0 :(得分:0)
应该这样做:
appDelegate.newsNavController = [[[UINavigationController alloc] initWithRootViewController:newsViewController] autorelease];
appDelegate.newsNavController.navigationBar.tintColor = [UIColor blackColor];
appDelegate.newsNavController.tabBarItem.image = [UIImage imageNamed:@"IdCard.png"];
appDelegate.newsNavController.tabBarItem.title = NSLocalizedString(@"Title_News", @"");