执行如下按钮。按钮开始时为灰色,但结束时不恢复为橙色,为什么?
@IBAction func calculatePower(sender: AnyObject) {
self.calculateButton.enabled = false
self.calculateButton.backgroundColor = UIColor.lightGrayColor()
self.calculateButton.titleLabel!.text = "Calculating"
// SEVERAL HUNDREDS OF THOUSANDS OF CALCS INBETWEEN = TAKES 1 MIN
self.calculateButton.enabled = true
self.calculateButton.backgroundColor = UIColor.orangeColor()
self.calculateButton.titleLabel!.text = "Start"
}
最佳答案
[myButton setTitle:@"Normal State Title" forState:UIControlStateNormal];
要么
myButton.setTitle("Normal State Title", forState: .Normal)
应该做到的