1.AppDelegate.m
#import
"RootTabBarController.h"
self.window
= [[UIWindow
alloc]
initWithFrame:[UIScreen
mainScreen].bounds];
self.window.backgroundColor
= [UIColor
whiteColor];
[self.window
makeKeyAndVisible];
self.window.rootViewController
= [[RootTabBarController
alloc]
init];
|
2.RootTabBarController.m
#import "RootTabBarController.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "FourViewController.h"
@interface RootTabBarController ()
@end
@implementation RootTabBarController
- (void)viewDidLoad {
[super viewDidLoad];
//1.获取Storyboard文件
UIStoryboard *one = [UIStoryboard storyboardWithName:@"one" bundle:nil];
//2.获取导航控制器
UINavigationController *oneN = [one instantiateViewControllerWithIdentifier:@"one"];
UIStoryboard *two = [UIStoryboard storyboardWithName:@"two" bundle:nil];
UINavigationController *twoN = [two instantiateViewControllerWithIdentifier:@"two"];
UIStoryboard *three = [UIStoryboard storyboardWithName:@"three" bundle:nil];
UINavigationController *threeN = [three instantiateViewControllerWithIdentifier:@"three"];
UIStoryboard *four = [UIStoryboard storyboardWithName:@"four" bundle:nil];
UINavigationController *fourN = [four instantiateViewControllerWithIdentifier:@"four"];
self.viewControllers = @[oneN, twoN, threeN, fourN];
}