【发布时间】:2021-04-18 11:25:03
【问题描述】:
我的按钮图像在禁用后改变颜色?
尽管有:
button.adjustsImageWhenDisabled = false
通常我的图像颜色由自定义 tintColor 设置。
为什么按钮的行为不同? tintColor 应该始终相同,尽管按钮状态...
【问题讨论】:
我的按钮图像在禁用后改变颜色?
尽管有:
button.adjustsImageWhenDisabled = false
通常我的图像颜色由自定义 tintColor 设置。
为什么按钮的行为不同? tintColor 应该始终相同,尽管按钮状态...
【问题讨论】:
在界面生成器中,您是否尝试过将状态配置设置为禁用并在其中设置禁用的图像?
或者在代码中使用..
button.setImage(<UIImage>, for: .disabled)
【讨论】:
与其禁用按钮,不如将其 userInteraction 属性更改为 false。
button.isUserInteractionEnabled = false
【讨论】: