在我的 iPhone 应用程序中,我有一个在 Interface Builder 中创建的 UIButton.我可以像这样在我的代码中成功启用和禁用它...
In my iPhone app, I have a UIButton which I have created in Interface Builder. I can successfully enable and disable it like this in my code ...
sendButton.enabled = YES;
或
sendButton.enabled = NO;
但是,按钮的视觉外观始终相同!它不会褪色或变灰.如果我尝试单击它,它会按预期启用或禁用.我错过了什么吗?它不应该看起来褪色或变灰吗?
However, the visual look of the button is always the same! It is not faded or grey. If I attempt to click it though, it is enabled or disabled as expected. Am I missing something? Shouldn't it look faded or grey?
可以使用如下代码:
sendButton.enabled = YES;
sendButton.alpha = 1.0;
or
sendButton.enabled = NO;
sendButton.alpha = 0.5;
这篇关于禁用的 UIButton 不褪色或变灰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!