【发布时间】:2018-07-04 15:33:11
【问题描述】:
【问题讨论】:
-
显示您尝试过的代码?什么不工作?
-
我已将图像提供给情节提要中的按钮。我的按钮类型是自定义的
-
那么问题在哪里?
-
设置 tint color 使图像变成单色,这是预期的行为。
-
但我的色调是默认的
【问题讨论】:
试试这个:
if let btnImg = yourBtnOutlet.imageView?.image {
yourBtnOutlet.setImage(btnImg.withRenderingMode(.alwaysTemplate), for: .normal)
yourBtnOutlet.tintColor = UIColor.red
}
【讨论】: