//1.使用步骤:
//(1)初始化UITabBarController
//(2)设置UIWindow的rootViewController为UITabBarController
//(3)创建相应的子控制器(viewcontroller)
//(4)把子控制器添加到UITabBarController
UITabBarController *tbC = [[UITabBarController alloc]init];
tbC.tabBar.barTintColor = [UIColor yellowColor];
//创建子控制器
nav.tabBarItem.title = @"消息";
nav.tabBarItem.image = [UIImage imageNamed:@"tabbar_message_center"];
nav.tabBarItem.badgeValue = @"123";
TowViewController *tow = [TowViewController new];
tow.tabBarItem.title = @"收索";
tow.tabBarItem.image = [UIImage imageNamed:@"tabbar_discover"];
tow.tabBarItem.selectedImage = [UIImage imageNamed:@"tabbar_discover_selected"];
threeViewController *three = [threeViewController new];
three.tabBarItem.title = @"收索";
three.tabBarItem.image = [UIImage imageNamed:@"tabbar_discover"];
FourViewController *four = [FourViewController new];
four.tabBarItem.title = @"收索";
four.tabBarItem.image = [UIImage imageNamed:@"tabbar_discover"];
//添加子控制器到UITabBarController上
tbC.viewControllers = @[nav,tow,three,four];
//设置默认显示的子控制器
tbC.selectedIndex = 0;
//3.设置根视图
self.window.rootViewController = tbC;
//4、显示窗口
[self.window makeKeyAndVisible];