我有一个UIButton并且我创建了一个扩展来为不同的状态添加背景颜色。我正在使用以下代码:extensionUIButton{funcsetBackgroundColor(color:UIColor,forState:UIControlState){UIGraphicsBeginImageContext(CGSize(width:1,height:1))CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(),color.CGColor)CGContextFillRect(UIGraphicsGetCurrentCont
我有一个UIButton并且我创建了一个扩展来为不同的状态添加背景颜色。我正在使用以下代码:extensionUIButton{funcsetBackgroundColor(color:UIColor,forState:UIControlState){UIGraphicsBeginImageContext(CGSize(width:1,height:1))CGContextSetFillColorWithColor(UIGraphicsGetCurrentContext(),color.CGColor)CGContextFillRect(UIGraphicsGetCurrentCont