swift 按钮设置图片 颜色

qingzZ / 2023-08-05 / 原文

 

                actionBtn.setTitleColor(UIColor.gray, for: UIControl.State.normal)
                actionBtn.tintColor = UIColor.gray
                actionBtn.setImage(UIImage.init(named: "report")?.withTintColor(UIColor.gray, renderingMode: UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal)

  

imageView 设置同理