UIButton没有更新?

时间:2016-03-02 21:40:47

标签: ios swift uibutton

执行如下按钮。按钮在开始时变为灰色但最后没有恢复为橙色,为什么?

@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"

}

1 个答案:

答案 0 :(得分:0)

[myButton setTitle:@"Normal State Title" forState:UIControlStateNormal];

myButton.setTitle("Normal State Title", forState: .Normal)

应该做的伎俩