我的代码中有以下AppDelegate
代码UINavigationBar
:
NSArray *viewsArray;
ToolsViewController *toolsnavigation = [[ToolsViewController alloc] initWithNibName:@"ToolsViewController" bundle:nil];
toolsnavigation.tabBarItem.image = [UIImage imageNamed:@"setting_image.png"];
[toolsnavigation setTitle:@"Tools"];
UINavigationController *nav0 = [[UINavigationController alloc] initWithRootViewController:toolsnavigation];
MyrideViewController *myridenavigation = [[MyrideViewController alloc] initWithNibName:@"MyrideViewController" bundle:nil];
myridenavigation.tabBarItem.image = [UIImage imageNamed:@"bottom_nav_image_2.png"];
[myridenavigation setTitle:@"My Ride"];
UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:myridenavigation];
NewsViewController *newsnavigation = [[NewsViewController alloc] initWithNibName:@"NewsViewController" bundle:nil];
newsnavigation.tabBarItem.image = [UIImage imageNamed:@"bottom_nav_image_3.png"];
[newsnavigation setTitle:@"News"];
UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:newsnavigation];
CoolViewController *coolnavigation = [[CoolViewController alloc] initWithNibName:@"CoolViewController" bundle:nil];
coolnavigation.tabBarItem.image = [UIImage imageNamed:@"bottom_nav_image_4.png"];
[coolnavigation setTitle:@"Cool"];
UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:coolnavigation];
AccidentViewController *accidentnavigation = [[AccidentViewController alloc] initWithNibName:@"AccidentViewController" bundle:nil];
accidentnavigation.tabBarItem.image = [UIImage imageNamed:@"bottom_nav_image_5.png"];
[accidentnavigation setTitle:@"Accident"];
UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:accidentnavigation];
viewsArray = [NSArray arrayWithObjects:nav0,nav1,nav2,nav3,nav4, nil];
UITabBarController *tabbarController = [[UITabBarController alloc] init];
tabbarController.view.frame = CGRectMake(0,0,320,460);
[tabbarController setViewControllers:viewsArray];
self.window.rootViewController = tabbarController;
这样,UINavigationBar 就会出现在每个页面上。我希望它出现在几页之后,就像用户登录后,导航栏就会出现。我当前的代码不会发生这种情况。我怎样才能解决这个问题?