我试图改变UIButtons颜色,使用标签值,我有2个不同的代码,但它们都不起作用。
self.view.viewWithTag(Int(buttonNumber))?.backgroundColor = UIColor.blueColor()
var tempButton = self.view.viewWithTag(Int(buttonNumber)) as? UIButton
tempButton?.backgroundColor = UIColor.blueColor()
这些都不起作用,我也找不到如何解决这个问题
答案 0 :(得分:0)
这对我有用:
var tempButton = self.view.viewWithTag(Int(buttonNumber)) as? UIButton
tempButton?.backgroundColor = UIColor.blue.withAlphaComponent(0.6)
我希望它有所帮助