执行如下按钮。按钮在开始时变为灰色但最后没有恢复为橙色,为什么?
@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"
}
答案 0 :(得分:0)
[myButton setTitle:@"Normal State Title" forState:UIControlStateNormal];
或
myButton.setTitle("Normal State Title", forState: .Normal)
应该做的伎俩