//TabBar
UITabBarController *tabBarCtrl = [[UITabBarController alloc]init];
tabBarCtrl.tabBar.backgroundColor = [UIColor whiteColor];
tabBarCtrl.tabBar.tintColor = [UIColor whiteColor];
//navigationBar
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:tabBarCtrl];
self.window.rootViewController = nav;
//創建子控制器
UIViewController *firstVC = [[UIViewController alloc]init];
firstVC.tabBarItem.title = @"first";
firstVC.tabBarItem.image = [UIImage imageNamed:@"1.png"];
firstVC.view.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.9];
firstVC.tabBarItem.selectedImage = [UIImage imageNamed:@"1.png"];
UIViewController *secondVC = [[UIViewController alloc]init];
secondVC.tabBarItem.title = @"first";
secondVC.tabBarItem.image = [UIImage imageNamed:@"2.png"];
secondVC.view.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.9];
secondVC.tabBarItem.selectedImage = [UIImage imageNamed:@"2.png"];
tabBarCtrl.viewControllers = @[firstVC,secondVC];