【发布时间】:2019-07-17 04:22:59
【问题描述】:
我在情节提要中有一个UIButton,它只显示图像而不显示文本。它的类型是系统。点击按钮时需要更改图像的色调颜色。我如何使用UIButton's 状态配置来做到这一点?
我已尝试在代码中为不同状态使用setImage,如下所示,但无法使其正常工作。谢谢
setImage(UIImage(named: "test")?.applying(tintColor: .red), for: .highlighted)
setImage(UIImage(named: "test")?.applying(tintColor: .blue), for: .normal)
【问题讨论】:
标签: ios swift xcode uibutton uiimageview