tabBarController管理多个Storyboard

self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

self.window.backgroundColor = [UIColor whiteColor];

// 2.创建TabBarCongtroller

UITabBarController *tab = [[UITabBarController alloc] init];

// 3.加载Storyboard

UIStoryboard *homeVC =[UIStoryboard storyboardWithName:@"Home" bundle:nil];

UIStoryboard *messageVC =[UIStoryboard storyboardWithName:@"Message" bundle:nil];

UIStoryboard *pointVC =[UIStoryboard storyboardWithName:@"Point" bundle:nil];

UIStoryboard *MineVC =[UIStoryboard storyboardWithName:@"mine" bundle:nil];

//3.5 设置tabBarItem

UINavigationController *homeNav = [homeVC instantiateInitialViewController];

UIViewController *home = homeNav.topViewController;

home.title = @"首页";

UINavigationController *messageNav = [messageVC instantiateInitialViewController];

UIViewController *message = messageNav.topViewController;

message.tabBarItem.title = @"消息";

message.tabBarItem.image = [UIImage imageNamed:@"1"];

// 4.创建Storyboard添加到TabBarCongtroller中

tab.viewControllers=@[homeNav,messageNav,pointVC.instantiateInitialViewController,MineVC.instantiateInitialViewController];

// 5.设置根控制器

self.window.rootViewController = tab;

// 6.显示Window

[self.window makeKeyAndVisible];

你可能感兴趣的:(tabBarController管理多个Storyboard)