Disabled UIButton not faded or grey(禁用的 UIButton 不褪色或变灰)
本文介绍了禁用的 UIButton 不褪色或变灰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的 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 不褪色或变灰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:禁用的 UIButton 不褪色或变灰


猜你喜欢
- GPS状态的广播接收器? 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- UITextView 内容插图 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- URL编码Swift iOS 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01