Difference between enabled and userInteractionEnabled properties
来源:互联网 发布:芜湖java招聘 编辑:程序博客网 时间:2024/06/05 09:40
I read through the documentation, and here are my findings.
UIButton
inherits from UIControl
the boolean property enabled
A Boolean value that determines whether the receiver is enabled.
Specify YES to make the control enabled; otherwise, specify NO to make it disabled. The default value is YES. If the enabled state is NO, the control ignores touch events and subclasses may draw differently.
UIControl
inherits from UIView
the boolean property userInteractionEnabled
:
A Boolean value that determines whether user events are ignored and removed from the event queue.
When set to NO, user events—such as touch and keyboard—intended for the view are ignored and removed from the event queue. When set to YES, events are delivered to the view normally. The default value is YES.
From this I conclude
button.userInteractionEnabled = NO
means the button looks normal but doesn't respond to touches (from theUIView
inheritance).button.enabled = NO
means the button is grayed out and doesn't respond to touches (from theUIControl
inheritance).
总的来说, userInteractionEnabled = NO,view看起来还是正常的,但是不能响应点击事件。
enabled = NO, view会变灰,如果有文字,文字也会变灰色。view也不能响应点击事件。
- Difference between enabled and userInteractionEnabled properties
- Difference between Properties and Attributes in JavaScript
- android: what is the difference between focused, enabled, pressed, and selected states?
- The difference between (()) and ().
- difference between "<" and "<<"
- Difference Between RFC and BAPI(待RFC Vs BAPI - by Madhukirann BAPI are RFC enabled function modul译)
- Difference Between typedef and #define
- Difference between PCDATA and CDATA
- Difference between CComPtr and CComQIPtr
- Difference between RVCT and GCCE
- Difference between RVCT and GCCE
- difference between slist and list.
- difference between stack and heap
- Difference between replace and translate
- Difference between PrintWriter and PrintStream
- difference between Cookie and Session
- Difference Between Buffer and Cache
- Difference between Statement and preparedStatement
- java web项目用cookie记住用户名、密码
- 阅读underscore源码笔记
- 杂事 游泳记事
- 搭建基于注解方式的SSH项目框架
- maven教程三之maven命令
- Difference between enabled and userInteractionEnabled properties
- 企业级搜索应用服务器Solr4.10.4部署开发详解(1)- Solr入门-安装部署
- android 如何解决scrollTo无法执行
- Spring面试题
- iOS录音实践
- GridView的点击事件冲突解决
- zoj3699 Dakar Rally (单调队列+贪心)
- Xcode unable to dequeue a cell with identifier
- 悟空学Linux专栏----第4篇