我已经使用情节提要在导航控制器中设置了一个具有标签栏控制器作为屏幕的应用程序。我可以很好地导航到它,但是当我开始在其中一个选项卡中向下钻取屏幕时,选项卡栏消失了。如果我导航回到标签栏应该打开的第一个屏幕,标签栏将重新出现,但我希望它在子屏幕上可见。这是可能的还是两个视图控制器不能很好地协同工作?
问问题
280 次
2 回答
0
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
MenuViewController * menuViewController=[[[MenuViewController alloc] initWithNibName:@"MenuViewController_iPhone" bundle:nil] autorelease];
menuViewController.hidesBottomBarWhenPushed=YES;
//menuViewController You can have your option here
UINavigationController * navigationController;
UINavigationController * navigationController2;
UINavigationController * navigationController3;
viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil] autorelease];
navigationController=[[UINavigationController alloc] initWithRootViewController:viewController1];
navigationController2=[[UINavigationController alloc] initWithRootViewController:viewController2];
navigationController3=[[UINavigationController alloc] initWithRootViewController:menuViewController];
UITabBarController * tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:menuViewController,navigationControllerFirst, viewController2, nil];
//self.tabBarController.tabBar.tintColor=[UIColor orangeColor];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return true;
}
于 2012-07-09T19:54:27.140 回答
0
标签栏控制器始终需要是根视图控制器。你不能把它放在导航控制器里面。
即使有可能,也不会是良好的用户交互。你到底想做什么(功能性)?
我认为您想要的是将导航控制器作为第一个选项卡放置在选项卡栏控制器内。(不像你描述的那样反过来)
于 2012-07-09T19:43:36.953 回答