【发布时间】:2014-10-16 20:57:46
【问题描述】:
我有一个 UIButton,它链接到 UIView 中的 IBAction。在此 IBAction 中,我更改了 UIButton 的 titleLabel 的文本并禁用了 UIButton。但是,我发现当动作触发时,按钮会在重新启用之前禁用自身并在瞬间更改其文本。这几乎就像它在按下按钮时发生,然后它会自行撤消。有人可以帮忙吗?如果有用的话,我正在使用最新的 Xcode 和 iOS 8 SDK。
//this is the IBAction...it happens, but the enabled property and text change quickly undoes itself.
@IBAction func solvePuzzle(sender: AnyObject) {
self.activity.startAnimating()
self.solveButton.enabled = false
self.solveButton.titleLabel?.text = "Solving..."
}
【问题讨论】: