如果在 iOS 中按下按钮,如何禁用它?
How to disable a button if it is pressed in iOS?
我一直在看这里的其他教程,看看如何让按钮无法按下。但是,我不断收到此错误:
'Value of type '(UIButton) -> ()' has no member 'isEnabled'
密码是:
@IBAction func PlayButton(_ sender: UIButton) {
PlayButton.isEnabled = false
}
你这样做:
sender.isEnabled = false
另请注意,您的 @IBAction
函数与按钮同名。这会导致名称歧义。将函数的名称更改为其他名称。
我一直在看这里的其他教程,看看如何让按钮无法按下。但是,我不断收到此错误:
'Value of type '(UIButton) -> ()' has no member 'isEnabled'
密码是:
@IBAction func PlayButton(_ sender: UIButton) {
PlayButton.isEnabled = false
}
你这样做:
sender.isEnabled = false
另请注意,您的 @IBAction
函数与按钮同名。这会导致名称歧义。将函数的名称更改为其他名称。