TabBarController--4 * NavigationController (TabBarItem/ViewController)
- (void)viewDidLoad
{
[super viewDidLoad];
firstViewController = [[FirstViewController alloc]init];
UINavigationController *firstNav = [[UINavigationController alloc]initWithRootViewController:firstViewController];
UITabBarItem* firstItem = [[UITabBarItem alloc]initWithTitle:@"aaa" image:[UIImage imageNamed:@"aaa"] tag:0];
firstItem.selectedImage = [[UIImage imageNamed:@"aaa_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[firstNav setTabBarItem:firstItem];
producesMainViewController = [[ProducesMainViewController alloc]initWithNibName:@"ProducesMainViewController" bundle:[NSBundle mainBundle]];
UINavigationController *producesNav = [[UINavigationController alloc]initWithRootViewController:producesMainViewController];
UITabBarItem *productionItem = [[UITabBarItem alloc]initWithTitle:@"bob" image:[UIImage imageNamed:@"bbb"] tag:0];
productionItem.selectedImage = [[UIImage imageNamed:@"bbb_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[producesNav setTabBarItem:productionItem];
DailyAndInfoVC *informationVC = [[DailyAndInfoVC alloc]initWithNibName:@"DailyAndInfoVC" bundle:[NSBundle mainBundle]];
UINavigationController *informationNav = [[UINavigationController alloc]initWithRootViewController:informationVC];
UITabBarItem *informationItem = [[UITabBarItem alloc]initWithTitle:@"ccc" image:[UIImage imageNamed:@"ccc"] tag:0];
informationItem.selectedImage = [[UIImage imageNamed:@"ccc_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[informationNav setTabBarItem:informationItem];
[informationItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(153, 152, 152),NSForegroundColorAttributeName, [UIFont systemFontOfSize:13],NSFontAttributeName,nil] forState:UIControlStateNormal];
[informationItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[StaticTools colorWithHexString:@"#d70031"],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
myselfViewController = [[MyselfViewController alloc]init];
UINavigationController *myselfNav = [[UINavigationController alloc]initWithRootViewController:myselfViewController];
UITabBarItem *myselfItem = [[UITabBarItem alloc]initWithTitle:@"ddd" image:[UIImage imageNamed:@"ddd"] tag:0];
myselfItem.selectedImage = [[UIImage imageNamed:@"ddd_p"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[myselfNav setTabBarItem:myselfItem];
[firstItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(153, 152, 152),NSForegroundColorAttributeName, [UIFont systemFontOfSize:13],NSFontAttributeName,nil] forState:UIControlStateNormal];
[productionItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(153, 152, 152),NSForegroundColorAttributeName, [UIFont systemFontOfSize:13],NSFontAttributeName,nil] forState:UIControlStateNormal];
[myselfItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:RGBCOLOR(153, 152, 152),NSForegroundColorAttributeName, [UIFont systemFontOfSize:13],NSFontAttributeName,nil] forState:UIControlStateNormal];
[firstItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[StaticTools colorWithHexString:@"#d70031"],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
[productionItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[StaticTools colorWithHexString:@"#d70031"],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
[myselfItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[StaticTools colorWithHexString:@"#d70031"],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
self.tabBarController = [[UITabBarController alloc]init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:firstNav,producesNav,informationNav,myselfNav, nil];
self.tabBarController.selectedIndex = 0;
self.tabBarController.delegate = self;
self.tabBarController.view.frame = self.view.frame;
[self.view addSubview:self.tabBarController.view];
}