主屏幕后没有显示标题。我在第一个屏幕后放了UITabBarController
。第一个屏幕没有UITabBarController
。我不确定我实施标签的方式。
我已在self.title = @"title"
的每个视图控制器中设置了标题。标题正确地显示在标签项中。
AppDelegate.m:
UIViewController *loginView= [[[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil] autorelease];
UINavigationController *loginViewNavController = [[UINavigationController alloc] initWithRootViewController:loginView ];
self.navigationController = loginViewNavController;
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
LoginViewController.m:
-(IBAction)navigateMainMenu:(id)sender{
tabBarController = [[UITabBarController alloc] init];
MyAccountsViewController *vc1 = [[MyAccountsViewController alloc] initWithNibName:@"MyAccountsViewController" bundle:nil];
DepositsViewController *vc2 = [[DepositsViewController alloc] initWithNibName:@"DepositsViewController" bundle:nil];
MoreViewController *vc3 = [[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:nil];
PayTransViewController *vc4 = [[PayTransViewController alloc]init];
NSArray* controllers = [NSArray arrayWithObjects:vc1,vc4, vc2, vc3, nil];
tabBarController.viewControllers = controllers;
[self.navigationController pushViewController:tabBarController animated:YES];
[mainMenuViewController release];
答案 0 :(得分:2)
主要以吼叫的方式显示标题: -
1. Self.title=@"Your Titile";
2. self.navigationItem.title=@"your Title";
3. when you using UItabBarController you can set Particular Viewcontroller as par your code Title like:-
vc1.title=@"your Title";
vc2.title=@"your Title";
vc3.title=@"your Title";
vc4.title=@"your Title";
答案 1 :(得分:2)
如果你设置self.title = @“Title”。该标题将在navController标题中设置。但是在你的TabBarController中,每个项目都是ViewController。不是navigationController。
问题:您在此行
[mainMenuViewController release];
答案 2 :(得分:1)
我建议你不要在navigationcontroller中使用tabbarcontroller。如果您使用tabbarcontroller,它应该是rootViewcontroller。