Reputation: 770
I have created a tab bar Controller in my main.storyboard and have subclassed it.
I have created storyboards for each tab to organize my work like so:
@interface SATabBarController ()
@end
@implementation SATabBarController
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *viewControllersArray = [[NSMutableArray alloc]initWithCapacity:5];
[viewControllersArray addObject:[[UIStoryboard storyboardWithName:@"Tab1" bundle:nil] instantiateInitialViewController]];
[viewControllersArray addObject:[[UIStoryboard storyboardWithName:@"Tab2" bundle:nil] instantiateInitialViewController]];
[viewControllersArray addObject:[[UIStoryboard storyboardWithName:@"Tab3" bundle:nil] instantiateInitialViewController]];
[viewControllersArray addObject:[[UIStoryboard storyboardWithName:@"Tab4" bundle:nil] instantiateInitialViewController]];
[viewControllersArray addObject:[[UIStoryboard storyboardWithName:@"Tab5" bundle:nil] instantiateInitialViewController]];
[self setViewControllers:viewControllersArray];
}
@end
Now my question is. Is this okay to do? Are there any problems I might encounter with this method?
My storyboard was getting big and needed to find a way to separate.
Upvotes: 2
Views: 61
Reputation: 5694
We did this on one of the projects and it is reasonable thing to do when your app is growing big. Storyboards are slow when growing big and this is why previously we used hacks to split them into multiple parts and now in iOS 9 we officially can do it without hacks. However this need to split storyboard is their issue. Main value of storyboards is to visually represent navigation complexity in a way that you can overview the whole thing while when splitting it into parts you can not do this. So technically it is right, conceptually it is wrong. Good luck :)
Upvotes: 0
Reputation: 160
There are two disadvantages to this approach that I can see immediately:
Hope this helps,
Josh.
Upvotes: 1