I am looking for the behaviour in iOS to remove all the items/objects in my tabBar but also be able to restore them later on. To remove all items/objects the following code is working fine:
NSMutableArray *controllers = [NSMutableArray arrayWithArray:self.tabBarController.viewControllers];
[controllers removeAllObjects];
[self.tabBarController setViewControllers:controllers animated:YES];
But how do I restore the default tabBar once again after it being removed? Try to be specific.
Thanks in advance.
// backup the current viewcontrollers
NSArray *viewControllerBackup = self.tabBarController.viewControllers;
// remove tabs
[self.tabBarController setViewControllers:@[] animated:YES];
// restore tabs
[self.tabBarController setViewControllers:viewControllerBackup animated:YES];