系统默认的UITabBarController的title的颜色是蓝色,但是有时我们需要将其字体的颜色设置为我们图片的颜色。
设置选中状态的字体颜色(橙色)
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor orangeColor],NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
设置非选中状态的字体颜色(白色)
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];