0
我希望把中的UITabBar一样的两种观点,但不是在MainViewController,因为我没有使用的AppDelegate把它。如何在不使用AppDelegate的情况下以编程方式添加UITabBarController?
有没有的.xib或情节串连图板解决方案
我希望把中的UITabBar一样的两种观点,但不是在MainViewController,因为我没有使用的AppDelegate把它。如何在不使用AppDelegate的情况下以编程方式添加UITabBarController?
有没有的.xib或情节串连图板解决方案
UIViewController *vc1 = [[UIViewController alloc] init];
vc1.title = @"FIRST";
vc1.view.backgroundColor = [UIColor blueColor];
UIViewController *vc2 = [[UIViewController alloc] init];
vc2.title = @"SECOND";
vc2.view.backgroundColor = [UIColor redColor];
UITabBarController *tabBar = [[UITabBarController alloc] init];
tabBar.viewControllers = @[vc1,vc2];
tabBar.selectedIndex = 1;
tabBar.view.frame = CGRectMake(50, 50, 220, 320);
[tabBar willMoveToParentViewController:self];
[self.view addSubview:tabBar.view];
[self addChildViewController:tabBar];
[tabBar didMoveToParentViewController:self];
我应该把在我MainViewController? –
把它放在你想添加tabBar – morroko
谢谢,但我可以在哪里放置物品的动作? –