参考iOS 解决UITabBarItem选中图片默认为蓝色的方法
HomeViewController *homeVC = [[HomeViewController alloc] init];
homeVC.title = @"主页";
UINavigationController *homeNaVC = [[UINavigationController alloc] initWithRootViewController:homeVC];
UIImage * homeImage = [UIImage imageNamed:@"shouye"];
homeImage = [homeImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage * homeSelectImge = [UIImage imageNamed:@"shouyeSelect"];
//第一种解决方法:因为系统默认是将我们选中的图片渲染为蓝色的,所以在这里我们可以将选中的图片设置为初始值, 使其不被渲染就可以;这种方法需要我们设置每一个tabBarItem的selectedImage属性,比较繁琐;
homeSelectImge = [homeSelectImge imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UITabBarItem * homeItem = [[UITabBarItem alloc]initWithTitle:@"首页" image:homeImage selectedImage:homeSelectImge];
//改变tabBarItem字体的颜色
或者
image.png
网友评论