Ios4 将UINavigationController添加到xCode选项卡栏应用程序模板

Ios4 将UINavigationController添加到xCode选项卡栏应用程序模板,ios4,xcode4,uinavigationcontroller,uitabbarcontroller,Ios4,Xcode4,Uinavigationcontroller,Uitabbarcontroller,如何将UINavigationController添加到xCode选项卡栏应用程序委托 我的结构基于xCode选项卡栏应用程序委托,分别有两个选项卡,第一视图和第二视图。对于第一个视图,我添加了一个UITableView。我只想使用UINavigationController函数[self.navigationController pushViewController:animated:来推送子视图,并允许在子视图中显示导航栏。按下子视图后,选项卡栏必须仍在那里 听起来很简单,但我不知道如何实现

如何将UINavigationController添加到xCode选项卡栏应用程序委托

我的结构基于xCode选项卡栏应用程序委托,分别有两个选项卡,第一视图和第二视图。对于第一个视图,我添加了一个UITableView。我只想使用UINavigationController函数
[self.navigationController pushViewController:animated:
来推送子视图,并允许在子视图中显示导航栏。按下子视图后,选项卡栏必须仍在那里


听起来很简单,但我不知道如何实现它。请帮助。

我从基于窗口的模板开始,这样做也是为了实现同样的效果

我在我的应用程序代理中手动创建了我的
NavigationController
TabBarController

在您的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
添加以下内容:

//Seeting up the Navigation controllers and pushing our TableView controllers.  
UINavigationController *unvc1 = [[UINavigationController alloc] init];
UINavigationController *unvc2 = [[UINavigationController alloc] init];
[unvc1 pushViewController:someViewController1 animated:NO];
[unvc2 pushViewController:someViewController2 animated:NO];
[someViewController1 release];[someViewController2 release];//Releasing our TableView controllers. 

//Setting up the TabBar controller and pushing our Navigation controllers. 
UITabBarController *tbvc = [[UITabBarController alloc] init];
tbvc.viewControllers = [NSArray arrayWithObjects:unvc1, unvc2, nil];
[unvc1 release];[unvc2 release]; //releasing our Navigation controllers. 

我希望这有帮助

我使用presentModalViewController:animated完成了这项工作。我在modalView中添加了tabBar控制器。在didSelectRowAtIndexPath方法中,使用此presentModalViewController:animated。我可能并不完美,但我也有同样的问题,但现在我的应用程序可以按照我的需要工作。

有界面生成器解决方案吗?当然,但不幸的是,我没有使用该模板,所以我就这样设置了它。我知道这并不完全是你想要的,但它将帮助你前进。此外,可以使用IB创建任何推入
导航控制器
视图控制器
,从而创建
选项卡控制器