为了让tabbar的按钮没有被选中时,仍然保持原来的颜色
//设置图片绘制模式,使图片不变灰
UITabBarItem *oneBarItem = [[UITabBarItem alloc]init];
oneBarItem.image = [[UIImage imageNamed:@"news"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
oneBarItem.selectedImage = [UIImage imageNamed:@"news"];
oneBarItem.title = @"按钮";
使不选中的文字也不变灰色
//设置tebber选中时的颜色
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor redColor], NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];
// 设置tabber未选中字体颜色始终为白色
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil]
forState:UIControlStateNormal];