ios - 如果在iOS中按下按钮,如何禁用它?
问题描述
我一直在查看此处的其他教程,以了解如何使按钮无法按下。但是,我不断收到此错误:
'(UIButton) -> ()' 类型的值没有成员 'isEnabled'
代码是:
@IBAction func PlayButton(_ sender: UIButton) {
PlayButton.isEnabled = false
}
解决方案
你这样做:
sender.isEnabled = false
另请注意,您的@IBAction
函数与按钮具有相同的名称。这会导致名称歧义。将函数的名称更改为其他名称。
推荐阅读
- r - 基于复选框的条件输出
- javascript - Javascript,无法读取未定义的属性,但打印到控制台
- google-play - 通过我自己的应用程序的 API 从 google play 获取下载数据
- r - R拟合函数仅返回起始编号
- ms-access - 访问 - 创建查询以匹配多个条件
- javascript - 如何在关联查询中指定外键
- jar - 我在 InteliJ 中构建我的程序的 .jar,但我使用 JTatto LookAndFeel 添加了外部 .jar,并且该应用程序无法在桌面上运行。如何修复它?
- dymola - 如何在 Dymola 中自动创建转换脚本
- c - 如何使用 C 语言中的指针在字符串数组中查找相同字符的基地址?
- r - 如何在R中搜索带括号的字符串