Swift tabBarItem设置selectedImage只显示轮廓

  • 可以这样设置
let personalVC = PersonalCenterVC.init(nibName: "PersonalCenterVC", bundle: nil);
personalVC.tabBarItem.selectedImage = UIImage.init(named: "[email protected]")?.withRenderingMode(.alwaysOriginal);
//后面加上withRenderingMode(.alwaysOriginal);
  • 修改tabBarItem 选中字体颜色
 UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.init(colorLiteralRed: 119 / 255, green: 142 / 255, blue: 242 / 255 , alpha: 1)], for: .selected);

你可能感兴趣的:(Swift tabBarItem设置selectedImage只显示轮廓)