修改TabBarViewController上标题字体颜色

  UINavigationController *newNavVc = [[UINavigationController alloc]init];

    newNavVc.title = title;

    newVc.title = title;

    //设置TabBar上标题的字体颜色

    NSMutableDictionary *dictAttr = [NSMutableDictionary dictionary];

    //dictAttr[NSForegroundColorAttributeName] = [UIColor orangeColor];

    //dictAttr[NSFontAttributeName]=[UIFont systemFontOfSize:13];

     [dictAttr setObject:[UIColor orangeColor] forKey:NSForegroundColorAttributeName];

    [newNavVc.navigationBar setTitleTextAttributes:dictAttr];

    newVc.tabBarItem.title = title;

    newVc.tabBarItem.image = image;

    newVc.tabBarItem.selectedImage = selectImg;

    [newNavVc addChildViewController:newVc];

    //TabBar上的文字选中时变橙色

    [newVc.tabBarItem setTitleTextAttributes:dictAttr forState:UIControlStateSelected];

    [self addChildViewController:newNavVc];

相关文章:

  • 2021-12-15
  • 2021-12-12
  • 2021-10-14
  • 2021-08-28
  • 2021-08-03
  • 2021-12-16
  • 2021-11-27
  • 2021-10-26
猜你喜欢
  • 2021-08-01
  • 2021-09-27
  • 2021-09-29
  • 2021-10-24
  • 2021-09-13
  • 2021-10-24
  • 2022-01-02
  • 2017-11-23
相关资源
相似解决方案