Iphone 如果有5个以上的tabbar项,如何设置tabbar项的颜色而不是默认的蓝色?

Iphone 如果有5个以上的tabbar项,如何设置tabbar项的颜色而不是默认的蓝色?,iphone,controller,tabbar,Iphone,Controller,Tabbar,在我的应用程序中,我正在使用5个以上颜色为绿色(即自定义)的选项卡项的选项卡栏控制器。如我们所知,第五、第六。。选项卡栏项目由MoreViewController自动处理。 我的问题是 1) 如果我选择了更多选项卡项,我得到的是蓝色项。 2) 如果我从更多的选项卡项切换到上一个选项卡项,我也会将这些项的颜色设置为蓝色。 那么,如何在这两种情况下使tabbar项都变为绿色?在apple文档中,没有解决方案。最后,我用自己的定制按钮伪造了tabbar buddy you have 2 choice

在我的应用程序中,我正在使用5个以上颜色为绿色(即自定义)的选项卡项的选项卡栏控制器。如我们所知,第五、第六。。选项卡栏项目由MoreViewController自动处理。 我的问题是 1) 如果我选择了更多选项卡项,我得到的是蓝色项。 2) 如果我从更多的选项卡项切换到上一个选项卡项,我也会将这些项的颜色设置为蓝色。
那么,如何在这两种情况下使tabbar项都变为绿色?

在apple文档中,没有解决方案。最后,我用自己的定制按钮伪造了tabbar

buddy  you have 2 choices 

1. u take 2 image for every tabbar 1st disable tile 2nd show enable time



   self.window.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]]; //[UIColor blackColor];

    tabBarController = [[UITabBarController alloc] init];
    [tabBarController setDelegate: self];
   // [tabBarController.tabBar setDelegate:self];
    //tabBarController = [[UITabBarController alloc] init];
    tabBarController.tabBar.tintColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];
    //tabBarController.tabBarItem.title=[UIColor whiteColor];
    //[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
    //[[UITabBar appearance] setBackgroundColor:[UIColor whiteColor]];
    //tabBarController.tabBar.backgroundColor = [UIColor whiteColor];
    NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:7];
    Login *home = [[Login alloc] initWithNibName:@"Login" bundle:nil];
    localNavController = [[UINavigationController alloc] initWithRootViewController:home];
    //localNavController.tabBarItem.image = [UIImage imageNamed:@"Central.png"];
    localNavController.tabBarItem.title=@"Central";
    [localViewControllersArray addObject:localNavController];
    PuckDisplay *puck=[[PuckDisplay alloc]initWithNibName:@"Display" bundle:nil];
    localNavController = [[UINavigationController alloc] initWithRootViewController:uck];
    //localNavController.tabBarItem.image = [UIImage imageNamed:@"Display.png"];
    localNavController.tabBarItem.title=@" Display";
    [localViewControllersArray addObject:localNavController];

    PhotoBooth *photo=[[PhotoBooth alloc]initWithNibName:@"Booth" bundle:nil];
    localNavController = [[UINavigationController alloc] initWithRootViewController:photo];
    //localNavController.tabBarItem.image = [UIImage imageNamed:@"Booth.png"];
    localNavController.tabBarItem.title=@"Booth";
    [localViewControllersArray addObject:localNavController];

    More *more=[[More alloc]initWithNibName:@"More" bundle:nil];
    localNavController = [[UINavigationController alloc] initWithRootViewController:more];
    //localNavController.tabBarItem.image = [UIImage imageNamed:@"home.png"];
    localNavController.tabBarItem.title=@"More";
    [localViewControllersArray addObject:localNavController];

    tabBarController.viewControllers = localViewControllersArray;
    [[UITabBarItem appearance] setTitleTextAttributes:
    [NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor grayColor], UITextAttributeTextColor, 
    [UIColor grayColor], UITextAttributeTextShadowColor, 
    [NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset, 
    [UIFont fontWithName:@"Helvetica" size:0.0], UITextAttributeFont, nil] 
                                             forState:UIControlStateNormal];
    UITabBarItem *tabBarItem1 = [[self.tabBarController.tabBar items] objectAtIndex:0];
    [tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"CentralA.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Central.png"]];
    UITabBarItem *tabBarItem2 = [[self.tabBarController.tabBar items] objectAtIndex:1];
    [tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"DisplayA.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Display.png"]];
    UITabBarItem *tabBarItem3 = [[self.tabBarController.tabBar items] objectAtIndex:2];
    [tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:@"BoothA.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"Booth.png"]];
    UITabBarItem *tabBarItem4 = [[self.tabBarController.tabBar items] objectAtIndex:3];
    [tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"moreA.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"more.png"]];














2. if u want only change tabbar color then change tabbar tin color
self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:(157/255.0) green:(33/255.0) blue:(33/255.0) alpha:1];