我有背景颜色的UIButton,现在我希望将Button颜色设置为单独的颜色
我试过这种方法:
初始化:
var color1 = UIColor()
color1 = dateBtn1.backgroundColor!
设置:
if color1 == UIColor.lightGrayColor() {
dateBtn1.backgroundColor = UIColor.lightGrayColor()
}else{
dateBtn1.backgroundColor = UIColor(red: 85/255, green: 175/255, blue: 101/255, alpha: 1.0)
}
我的崩溃报告:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -isEqual: not defined for the UIColor <UIPlaceholderColor: 0x7f953241d150>; need to first convert colorspace.'