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 the UIView inheritance).

  • button.enabled = NO means the button
    is grayed out and doesn't respond to touches (from the UIControl inheritance).

总的来说, userInteractionEnabled = NO,view看起来还是正常的,可是不能响应点击事件。

enabled = NO。 view会变灰。假设有文字,文字也会变灰色。view也不能响应点击事件。

Difference between enabled and userInteractionEnabled properties的更多相关文章

  1. [MS SQL Server]SQL Server如何开启远程访问

    在日常工作中,经常需要连接到远程的MS SQL Server数据库中.当然也经常会出现下面的连接错误. 解决方法: 1. 设置数据库允许远程连接,数据库实例名-->右键--->属性---C ...

  2. anonymousIdentification 与匿名访问

    anonymousIdentification 元素(ASP.NET 设置架构) 来自 <https://msdn.microsoft.com/zh-cn/library/91ka2e6a(v= ...

  3. Spring Boot 添加Shiro支持

    前言: Shiro是一个权限.会话管理的开源Java安全框架:Spring Boot集成Shiro后可以方便的使用Session: 工程概述: (工程结构图) 一.建立Spring Boot工程 参照 ...

  4. Microsoft Win32 to Microsoft .NET Framework API Map

    Microsoft Win32 to Microsoft .NET Framework API Map .NET Development (General) Technical Articles   ...

  5. iOS开发——UI基础-UIScrollView

    一.UIScrollView使用的步骤 1.创建UIScrollView 2.将需要展示的内容添加到UIScrollView中 3.设置UIScrollView的滚动范围 (contentSize) ...

  6. Infragistics 汉化

    Infragistics 汉化实例: Infragistics.Shared.ResourceCustomizer rc=Infragistics.Win.UltraWinGrid.Resources ...

  7. iOS开发——UI篇&ScrollView详解

    创建方式 1:StoryBoard/Xib 这里StoarBoard就不多说,直接拖就可以,说太多没意思,如果连这个都不会我只能先给你跪了! 2:代码: CGRect bounds = [ [ UIS ...

  8. ScrollView详解

    创建方式 1:StoryBoard/Xib 这里StoarBoard就不多说,直接拖就可以,说太多没意思,如果连这个都不会我只能先给你跪了! 2:代码: 1 2 3 CGRect bounds = [ ...

  9. mapping 详解1(mapping type)

    映射(mapping) 映射是定义一个文档以及其所包含的字段如何被存储和索引的方法. 例如,用映射来定义以下内容: 哪些 string 类型的 field 应当被当成当成 full-text 字段 哪 ...

随机推荐

  1. box-shadow全面解析

    一.box-shadow语法: box-shadow: none | inset(可选值,不设置,为外投影,设置,为内投影) x-offset(阴影水平偏移量,正方向为right) y-offset( ...

  2. python自动化执行脚本

    ---恢复内容开始--- 1 (1)首先在你的.py文件上加上一行代码注释: #!/usr/local/bin/python2.7 (2)终端下执行: crontab -e 进入后,输入i 进入可编辑 ...

  3. java 位运算权限管控(转载)

    这里笔者介绍一种很常用,也比较专业的权限控制思路.这里用java语言描述,其实都差不多的.要换成其他的语言主,自己转一下就可以了.为了方便起见,我们这里定义a^b为:a的b次方.这里,我们为每一个操作 ...

  4. 随机获取oracle数据库中的任意一行数据(rownum)

    最近看oracle资料的时候,了解rownum的概念,以前只知道对数据库表进行简单的增删改查: 看到了rownum的概念后,突然想到了好多业务场景应该都可以适用的,比如在进行随机发奖的时候, 我们就可 ...

  5. centos静默式安装Oracle11g

    1.   Centos及Oracle版本 Centos:CentOS release 6.4 (Final) Oracle:linux.x64_Oracle_11gR2_database 2.   硬 ...

  6. Sicily 2005.Lovely Number

    题目地址:2005.Lovely Number 思路: 若测试数据出现的次数为奇数,则输出它. 所以,可以先排序,若前后相等,前后都设为0,最后不为0的则可以输出. 具体代码如下: #include ...

  7. 【转】c/c++各种字符、字符串类型转换

    itoa   功 能:把一整数转换为字符串   用 法:char *itoa(int value, char *string, int radix);   详细解释:itoa是英文integer to ...

  8. IIS中启用gzip压缩(网站优化)

    HTTP协议上的GZIP编码是一种用来改进WEB应用程序性能的技术.大流量的WEB站点常常使用GZIP压缩技术来让用户感受更快的速度.这一般是指WWW服务器中安装的一个功能,当有人来访问这个服务器中的 ...

  9. Grunt使用心得

    1.安装npm 2.安装CLI ( npm install -g grunt-cli) 3.安装grunt (npm install grunt --save-dev) 4.添加gruntfile.j ...

  10. html5标签placeholder使用

    <!DOCTYPE HTML> <html> <body> <form action="/example/html5/demo_form.asp&q ...