1

我在 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"];

然后它不起作用。我想我需要在顶部设置导航栏的标题。但是怎么做呢?

4

1 回答 1

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", @"");
于 2012-05-29T06:06:16.623 回答