Iphone 如何使主页没有选项卡栏,然后在其中一个页面上添加选项卡栏?
我的程序有一个主页,它是一个菜单。用户选择其中一个按钮后,它进入选项卡栏。我不知道怎么做,我一直在寻找的所有东西都是整个程序的一个选项卡栏。你可以简单地做Iphone 如何使主页没有选项卡栏,然后在其中一个页面上添加选项卡栏?,iphone,objective-c,xcode,xcode4,Iphone,Objective C,Xcode,Xcode4,我的程序有一个主页,它是一个菜单。用户选择其中一个按钮后,它进入选项卡栏。我不知道怎么做,我一直在寻找的所有东西都是整个程序的一个选项卡栏。你可以简单地做 UITabBarController *tabBarController = [[UITabBarController alloc] init]; UIViewController *controller1 = [[UIViewController alloc] initWithNibName:@"View1" bundle:nil]; c
UITabBarController *tabBarController = [[UITabBarController alloc] init];
UIViewController *controller1 = [[UIViewController alloc] initWithNibName:@"View1" bundle:nil];
controller1.title = @"View1";
UIViewController *controller2 = [[UIViewController alloc] initWithNibName:@"View2" bundle:nil];
controller1.title = @"View2";
tabBarController.viewControllers = [NSArray arrayWithObjects:controller1,controller2,nil];
[self.navigationController pushViewController:tabBarController];
[controller1 release];
[controller2 release];
[tabBarController release];
很简单,让主视图控制器位于导航控制器内,并在需要时在该导航控制器内推送选项卡栏控制器。我是否必须添加额外代码才能使用推送视图控制器?