How do I disable a UIButton?(如何禁用 UIButton?)
问题描述
我正在做一个项目,我必须在一个 plist 中显示照片库的所有照片,并在 UIButton
s 上水平显示它们.
I am working on a project in which I have to show all photos of Photo Library in a plist and show them horizontally on UIButton
s.
我的应用程序也会有一个编辑按钮:当用户单击此按钮时,每个按钮上应该会显示一个删除标记(例如通常出现在其他 iPhone/iPad 应用程序中).
My app will also have an edit button: when the user clicks this button, a delete mark (such as usually appears in other iPhone/iPad apps) should show on each button.
但关键是:一旦这个删除标记出现,按钮的功能应该被禁用.我尝试使用以下方法完成此操作:
But here's the crucial bit: as soon as this delete mark appears, the functionality of the button should be disabled. I've tried accomplishing this with the following:
{
editbutton.enabled=NO;
}
...但它既不会产生错误也不会起作用.我该怎么办?
...but it neither produces an error nor works. What should I do?
推荐答案
请设置这个...
editButton.userInteractionEnabled = NO;
或者你可以使用
editButton.enabled = NO;
这篇关于如何禁用 UIButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何禁用 UIButton?


- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- URL编码Swift iOS 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- UITextView 内容插图 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01