First question on S/O, so apologies if I haven't followed any protocols. I have been trying to display conditionally 4 different types of scene using 4 UIViewControllers from the same UITabBar item. It has to be the same item on the TabBar, because the UIViewController used is dependent upon data rather than user selection.
I know that subclassing UITabBarController is not advised, so I have set up a UIViewController that handles the conditional selection of the required scene (see code below). This works well, but despite trying everything I can think of, fails to show the TabBar at the bottom of the newly selected view. I have also tried using a UINavigation controller, but this was less successful. In Storyboard, I have tried all the different permutations of setting the view sizes and presentation styles, change the Bottom Bar to Tab Bar in simulated metrics and tried using Segues. None have produced the requisite outcome.
- (void)viewDidLoad
{
[super viewDidLoad];
int m = 1;
UIViewController *viewController;
if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12 ) {
viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"M31TVC"];
}else if (m == 4 || m == 6 || m == 9 || m == 11 ){
viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"M30TVC"];
}else if (m == 13 ){
viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"M29TVC"];
}else if (m == 2 ){
viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"M28TVC"];
}else {
// error code here
}
viewController.hidesBottomBarWhenPushed = NO;
[self presentViewController:viewController animated:NO completion:nil];
}
Thank you in advance to anyone who knows how to do this thing.