Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何使主页没有选项卡栏,然后在其中一个页面上添加选项卡栏?_Iphone_Objective C_Xcode_Xcode4 - Fatal编程技术网

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];

很简单,让主视图控制器位于导航控制器内,并在需要时在该导航控制器内推送选项卡栏控制器。我是否必须添加额外代码才能使用推送视图控制器?