NavigationController中的TabBarController

时间:2011-05-12 11:40:55

标签: ios uinavigationcontroller uitabbarcontroller

我在UINavigationController中有一个UITabBarController,我知道UINavigationController的iOS文档说如下:

rootViewController

The view controller that resides at the bottom of the navigation stack. This object cannot be an instance of the UITabBarController class.

这是否意味着如果我已经在导航堆栈上安装了UIViewControllers,那么只要它不是根项目就可以推送UITabBarController吗?

我现在有这个并且一切似乎都没问题,除非我弹出UITabBarController,在任何TabBarItems ViewController中都没有调用dealloc或viewDidUnload,我是否需要做类似的事情才能使viewWillAppear工作? / p>

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {  
[viewController viewWillAppear:NO];
}

由于

1 个答案:

答案 0 :(得分:1)

我不确定在UINavigationController中使用UITabBarController是否可行。

我通常以相反的方式做到这一点

companyNavController = [[[UINavigationController alloc] initWithRootViewController:companyViewController] autorelease];
companyNavController.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemSearch tag:1];

[tabBarController setViewControllers:[NSArray arrayWithObjects:phoneBookNavController, companyNavController, faveNavController, settingsNavController, nil]];

如果你想隐藏应用程序的TabBar部分,你可以随时尝试hidesBottomBarWhenPushed来管理它。

HTH

相关问题