0

Is it possible to redesign a UITabBarController when clicking on a UITabBarItem?

When starting the app I want to have 5 UITabBarItems:

self.myTabBarController = [CustomTabbarControllerViewController alloc] init];
self.myTabBarController.viewControllers = @[controller1, controller2, controller3, controller4, controller5];
..

When I ll click on controller2 I would like myTabBarController.viewController to contain controllerA, controllerB, controllerC. controllerA will bring the previous tabBarController.

I tried to find some examples on the internet, but i couldn t find any.

just ME
  • 1,817
  • 6
  • 32
  • 53

1 Answers1

0

You can make 2 tabBarController and make then hidden and show. If you do this thing in single TabBarController then it will remove and add your viewController all time.

So best way to do is use 2 tabBarController in appDelegate.

Rajneesh071
  • 30,846
  • 15
  • 61
  • 74
  • how can i hide a tabBarController? Using myTabBarController2.hidesBottomBarWhenPushed = YES? – just ME Jul 22 '14 at 08:14
  • http://stackoverflow.com/questions/11273563/hide-uitabbar-when-pushed-while-retaining-touch/11273959#11273959 – Rajneesh071 Jul 22 '14 at 08:19
  • or [self.tabBarController.view setHidden:YES]; – Rajneesh071 Jul 22 '14 at 08:21
  • also how to check in AppDelegate if a UITabBarItem for viewController 2 is clicked in order to make the second tabBarController visible and make the first one hidden? – just ME Jul 22 '14 at 08:21
  • I have this error message: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'. Could this be because the first tabBarController already has 5 item defined? From what I ve read...iOS has a limit set to the number of tabBarItems and it s equal to 5. – just ME Jul 22 '14 at 08:26
  • You can implement UITabBarDelegate delegate, and didSelectItem – Rajneesh071 Jul 22 '14 at 09:09