标签视图控制器UITabBarController
标签视图控制器 UITabBarController
FirstViewController*first = [[FirstViewController alloc] init];
//创建一个UITableBarItem对象,作为first的 tabBarItem属性
//选中与不选中图片可以一样,可以不一样
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"第一" image:[UIImage
imageNamed:@"02-redo.png"] selectedImage:[UIImage imageNamed:@"07-map-marker.png"]];
first.tabBarItem= item; [item release];
UINavigationController*firstNC = [[UINavigationController alloc] initWithRootViewController:first];
SecondViewController*second = [[SecondViewController alloc] init];
second.tabBarItem.title = @"第二";
second.tabBarItem.image= [UIImage imageNamed:@"07-map-marker.png"];
UINavigationController *secondNC = [[UINavigationController alloc] initWithRootViewController:second];
/创建一个标签视图控制器 //最多显示5个.而且是以平分的姿态显示,多出5个
显示more-
UITabBarController *tabbarController= [[UITabBarController alloc] init];
tabbarController.viewControllers = @[firstNC,secondNC,thirdNC,fourthNC,fifthN C,sixNC];
//标签条设置
tabbarController.tabBar.tintColor = [UIColor orangeColor];
tabbarController.tabBar.barTintColor = [UIColor greenColor];
tabbarController.delegate = self;
self.window.rootViewController = tabbarController;
//选中第一个控制器为登陆是控制器 self.selectedIndex = 3;
//oneSelfNVC.tabBarController.selectedIn dex = 2;
//设置颜色tabBar
// self.tabBar.tintColor = [UIColor
purpleColor];
// self.tabBar.barTintColor = [UIColor
blueColor];