ios - 按下按钮后禁用 UIButton

标签 ios objective-c swift uibutton event-handling

我正在做一个项目,我需要在单击或按下按钮后禁用 UIButton

TIA

最佳答案

在您的 Button 操作方法上,将 Buttonenabled 设置为 NO

- (IBAction)buttonTapped:(UIButton*)sender {    
    sender.enabled = NO; // With disabled style on button 
    //If you doesn't want disabled style on button use this.
    sender.userInteractionEnabled = NO;
}

关于ios - 按下按钮后禁用 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39226326/

相关文章:

ios - 在 iOS8 中重启时清除应用程序中的 LocalStorage

ios - 子类化 UICollectionViewCell 导致永远不会被选择

iOS tableviewheader subview 未显示

objective-c - 在 Switch 语句中使用 Double

ios - 在 View 可见之前执行Segue

ios - 将数值数组的特定索引与 Swift 中的 Int 变量进行比较

ios - 如何在Xcode中使用网络安全色

ios - uiview autosizing displayed with 20 px shift 主要是在播放电影后

iOS Objective-C 如何获得 2 位小数四舍五入的浮点值?

ios - 检查用户连续使用应用的天数