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?


基础教程推荐
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01