在我的 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/