ios - 禁用的 UIButton 不褪色或灰色

标签 ios iphone cocoa-touch uibutton

在我的 iPhone 应用程序中,我有一个在 Interface Builder 中创建的 UIButton。我可以在我的代码中像这样成功启用和禁用它......

sendButton.enabled = YES;

sendButton.enabled = NO;

但是,按钮的视觉外观总是一样的!它没有褪色或变灰。如果我尝试单击它,它会按预期启用或禁用。我错过了什么吗?它不应该看起来褪色或灰色吗?

最佳答案

您可以使用以下代码:

sendButton.enabled = YES;
sendButton.alpha = 1.0;

or

sendButton.enabled = NO;
sendButton.alpha = 0.5;

关于ios - 禁用的 UIButton 不褪色或灰色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5715092/

相关文章:

iphone - 由于 Orientation/Shake,UINavigationController 加载 View 不正确

iphone - 从 iOS 上的视频文件中剥离元数据

ios - 通过POST方法发送带有图像的参数?

ios - 为 iOS 推送通知设置 Amazon EC2 服务器

ios - Clang GCC 扩展 - 括号中的 block 返回一个值

android - 我可以在没有谷歌服务的设备上使用谷歌Firestore吗?

ios - 更改 ImageView 图标的颜色 Swift

ios - 我应该使用 Apple 推送通知还是只是在后台提取简单应用程序的数据?

iphone - 我可以建立一个可以访问 iphone 相机的移动网站吗?

iphone - 如何像 Tweetie 应用程序一样在 UITableViewCell 底部添加渐变