Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITabBarController with diffent storyboard file for each ViewController of the TabBar

My team is developing an application that has a UITabBarController. We are using Storyboard to develop the interfaces and the flows.

Since we are a team, we cannot put all flow in just one storyboard, because it will cause in problems with syncing with SVN. So, the solution is to put each tab`s flow in one different storyboard file.

The connection between storyboards is not the problem when I can create an object to do the connection (a button, for example) as we can see in this tutorial.

But when I put a UITabBarController in one storyboard, I cannot manage the view element of the bottom bar (the tabBar itself) in a way to programmatically set the storyboard that will be displayed for each button of the tabBar.

For now, I have the TabBar and the UIViewControllers in the same .storyboard file as we can see:

enter image description here

So what I need is to connect different storyboards through one UITabBarController. How to do that?

like image 858
Renato Lochetti Avatar asked Dec 15 '22 08:12

Renato Lochetti


2 Answers

You can use Storyboard references to keep the sections of your app separate and in individual Storyboard files. With UITabBarController just ctrl-link to the reference and make sure that you add a UITabBarItem to your ViewController in the new Storyboard. enter image description here

like image 98
Lee Probert Avatar answered Mar 23 '23 00:03

Lee Probert


UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Yourstoryboard" bundle:nil];

UINavigationController *thisController = [storyboard instantiateViewControllerWithIdentifier:@"YourID"];

mytabBarController.viewControllers = @[phoneViewController];

I still think you should use git : )

like image 33
Radu Avatar answered Mar 22 '23 23:03

Radu