ios UITabBarController UINaviGationController 给你你想要的

UINaviGationController 背景色

- (void)setNav

{

    UINavigationBar *bar = [UINavigationBar appearance];

    //设置显示的颜色

    bar.barTintColor = [UIColor colorWithRed:62/255.0 green:173/255.0 blue:176/255.0 alpha:1.0];

    //设置字体颜色

    bar.tintColor = [UIColor whiteColor];

    [bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];

//或者用这个都行


//    [bar setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];


}

tabbar

 self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    NSArray *tabArr = @[@"客户管理",@"订单管理",@"会议管理",@"拜访管理"];
    UITabBarController *tab  = [[UITabBarController alloc]init];

    NSMutableArray *viewcontrllers = [[NSMutableArray alloc]init];
    for (int  i = 0 ;i<4; i++) {
        ForgetPWDVC *vc = [[ForgetPWDVC alloc]init];
        UINavigationController *tabNav = [[ UINavigationController alloc]initWithRootViewController:vc];
//完全按照图片颜色
//        [tabNav.tabBarItem setImage:
//         [[UIImage imageNamed:tabArr[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//item字体  颜色
        [tabNav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} forState:UIControlStateNormal];
         [tabNav.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor purpleColor]} forState:UIControlStateSelected];
        
        
        [tabNav.tabBarItem setImage:[UIImage imageNamed:tabArr[i]]];
        [tabNav.tabBarItem setTitle:tabArr[i]];
        [viewcontrllers addObject:tabNav];
    }
//背景色
    [tab.tabBar setBackgroundColor:[UIColor whiteColor]];
    [tab.tabBar setTranslucent:NO];
///选中颜色  
    tab.tabBar.tintColor   = [UIColor purpleColor];
    [tab setViewControllers:viewcontrllers];
    [self.window setRootViewController:tab];

    [self.window makeKeyAndVisible];

你可能感兴趣的:(ios UITabBarController UINaviGationController 给你你想要的)