为什么我的 UIButton 的背景颜色在状态配置中不受影响?
Why is the background color of my UIButton not affected in state config?
我正在尝试使用属性检查器配置 UIButton
禁用状态 'state config.' 如何配置禁用状态的背景颜色?
试试这个:
@IBAction func buttonStateChanged(sender: UIButton) {
if(sender.selected){
sender.backgroundColor = UIColor(red: 1.0, green: 0.0, blue: 0.2, alpha: 1.0)
}else{
sender.backgroundColor = UIColor(red: 1.0, green: 0.0, blue: 0.2, alpha: 1.0)
}
}
我正在尝试使用属性检查器配置 UIButton
禁用状态 'state config.' 如何配置禁用状态的背景颜色?
试试这个:
@IBAction func buttonStateChanged(sender: UIButton) {
if(sender.selected){
sender.backgroundColor = UIColor(red: 1.0, green: 0.0, blue: 0.2, alpha: 1.0)
}else{
sender.backgroundColor = UIColor(red: 1.0, green: 0.0, blue: 0.2, alpha: 1.0)
}
}