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];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、UITabBarController以其相关控件之间的关系 @interface UITabBarContro...
    西门淋雨阅读 3,165评论 0 1
  • 0.前言 一款产品做出来之后,如何改进、优化她?当然各方面的反馈、吐槽是一个重要因素,但带有主观情绪的“觉得、感觉...
    仔仔朱阅读 1,100评论 0 7
  • 1、阅读时间:70分钟 2、阅读内容:磨炼灵魂、提升心志 3、笔记重点: 一、对领导的要求是德重于才 “德...
    丫头_ae9d阅读 718评论 0 2
  • 第七课作业: 如果创作类型小说,你偏好哪一种?这一类型中给你印象最深刻的是哪一部作品?请评价此部作品,不低于200...
    艺小姐阅读 224评论 3 3
  • 突如其来的感冒 很难受 加之工作的不顺心 这糟糕的感觉被放大 忽冷忽热 像这天气忽晴忽暗
    草木和花和鸟阅读 252评论 0 0