【发布时间】:2014-12-26 03:41:06
【问题描述】:
我以编程方式创建了按钮,希望在单击按钮时更改颜色,例如,如果单击一个按钮将颜色更改为红色,单击另一个按钮意味着更改回默认值
我使用
创建了按钮 for var i=0 ;i<=8;i++{
var button = UIButton(..)
........... blah blah......
button.addTarget(..,action:"buttonsClick",...)
}
fun buttonsClick(sender:UIButton){
// here how to identify which button is clicked and change color to red if another is clicked means change to default color
var tagnum = sender.tag
}
或其他可用的解决方案
【问题讨论】:
标签: button dynamic swift colors background