如何在ios中实现嵌套的TabBar控制器?

时间:2015-01-12 06:22:23

标签: ios uitabbarcontroller

我需要实现一个嵌套的TabBar应用程序。例如,顶部会有四个tabbar项目,当我点击任何标签栏项目时,它必须加载tabbarcontroller,它将在底部包含3个tabbar项目,就像明智的每个顶部标签栏项目将启动tabbarcontroller。 我尝试使用MHTabbarcontroller将三个标签栏控制器添加到它,但它无法正常工作。  我需要实现这样的事情。 下面是我将三个标签栏控制器添加到MHTabBarcontroller中的代码。

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
TabBarViewControllerOne *TbOne = [sb instantiateViewControllerWithIdentifier:@"TabVcOne"];
TabBarViewControllerTwo *TbTwo = [sb instantiateViewControllerWithIdentifier:@"TabVcTwo"];
TabBarViewControllerThree *TbThree = [sb instantiateViewControllerWithIdentifier:@"TabVcThree"];
 NSArray *viewControllers = @[TbOne, TbTwo,TbThree];
MHTabBarController *tabBarController = [[MHTabBarController alloc] init];
tabBarController.delegate = self;
tabBarController.viewControllers = viewControllers;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = tabBarController;
[self.window makeKeyAndVisible];

enter image description here enter image description here

enter image description here

0 个答案:

没有答案