Samissa Samissa - 7 days ago 4x
Objective-C Question

Navigate to storyboard from a viewController programmatically

in my iOS application, I would like to navigate programmatically to a whole storyboard (tabBarController) from a viewcontroller.
I found this solution:

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Home" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"SMShopViewController"];
[self.navigationController pushViewController:controller animated:YES];

but it is not what I need, I want to show directly my tabBarController

thank you for your reply


As i understand, You have UITabBarController on storyboard like this and you want show it from code?

So, Firstly set storyboard identifier for UITabBarController

Then in code

UITabBarController *tabBar = [self.storyboard instantiateViewControllerWithIdentifier:@"KITTabBarController"];
[self.navigationController pushViewController:tabBar animated:NO]; 

If you have parent navigation controller better way to do it is:

[self.navigationController setViewControllers:@[tabBar] animated:YES];