Ios5 如何使用框架创建UITabviewcontroller

Ios5 如何使用框架创建UITabviewcontroller,ios5,Ios5,我有一个UItabviewcontroller的代码,以编程方式使用,但是如何创建它的框架,因为我在我的应用程序中使用它作为子视图,其中需要x、y宽度和高度坐标 UITabBarController*tabBarController=[[UITabBarController alloc]init] UIViewController *vc1 = [[UIViewController alloc] init]; UIViewController *vc2 = [[UIViewController

我有一个UItabviewcontroller的代码,以编程方式使用,但是如何创建它的框架,因为我在我的应用程序中使用它作为子视图,其中需要x、y宽度和高度坐标

UITabBarController*tabBarController=[[UITabBarController alloc]init]

UIViewController *vc1 = [[UIViewController alloc] init];
UIViewController *vc2 = [[UIViewController alloc] init];

UIView *v1 = [[UIView alloc] init];
UIView *v2 = [[UIView alloc] init];

vc1.title = @"vc1";
vc2.title = @"vc2";

tabBarController.viewControllers = [[NSArray alloc] initWithObjects:vc1, vc2, nil];

self.view = tabBarController.view;

当你用ios5标记你的问题时,我想你的应用程序只在ios5上运行。如果我理解正确,您希望在另一个视图控制器视图中显示tabBarController

在5.0之前,如果没有一些非常丑陋的黑客,这是不可能的。但是对于iOS5.x,现在有了一个API。请参阅“实现容器视图控制器”中的UIViewController文档。必须将tabBarController设置为当前视图控制器的子视图控制器。然后,您可以指定所需的帧,并将其添加到视图中