tabbar图片设置一般默认自动渲染 这样颜色会有出入
修改方法
1 改成使用原始图片 简单粗暴

2 代码设置
UIViewController *vc=[[UIViewController alloc]init];
vc.view.backgroundColor=[UIColor redColor];
vc.tabBarItem.title=@"发现";
vc.tabBarItem.image=[UIImage imageNamed:@"tabBar_find_icon"];
UIImage *image=[UIImage imageNamed:@"tabBar_find_click_icon"];
// 不让tabbar底部有渲染的关键代码
image=[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
vc.tabBarItem.selectedImage=image;
网友评论