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. 局域网指定 IP 地址后无法上网的问题

    子网掩码.默认网关.DNS 与局域网设置有关,建议指定前先 运行 cmd -> ipconfig /all 查看一下自动获取的信息. 另外留意指定IP 后需打开高级设置 -> WINS,勾 ...

  2. Linux驱动设备中的并发控制

    一.基本概念 二.中断屏蔽 三.原子操作 四.自旋锁 五.信号量 六.互斥体 七.自旋锁与信号量的比较 Linux设备驱动中必须解决的一个问题是多个进程对共享资源的并发访问,并发的访问会导致竞态,即使 ...

  3. Ftp实现文件同步

    通常在做服务器与服务器文件.服务器与本地文件同步时通过Ftp服务实现,下面就以服务器文件和本地同步为例,介绍一下Ftp同步文件:首先建立一个Ftp站点服务,基本身份验证登陆,端口号为默认的21:Ftp ...

  4. 网页、JavaScript 数据类型

    JavaScript 数据类型 一.基本数据类型: 字符串.数字.布尔.日期和时间 JavaScript 拥有动态类型 JavaScript 拥有动态类型.这意味着相同的变量可用作不同的类型: 1 v ...

  5. java对象Integer不能引用传递

    java对象Integer不能引用传递 /** * The value of the <code>Integer</code>. * * @serial */ private ...

  6. Ajax (jquery)实现智能提示搜索框(in Django)

    搜索框输入搜索名字,从数据库中筛选名字, 如果有包含输入的字母的名字则以json格式返回并且显示在搜索框下:          html文件: <!DOCTYPE html> <ht ...

  7. 新Android学习计划

    最近,在学习Android Design Support Library提供的新控件过程中,我感受到了原来的学习方式的缺点: 学习内容过于随意,在工作过程中碰到的新问题都想去掌握,心血来潮就想写一篇相 ...

  8. ArcGIS Server Manager登陆不了

    我很是郁闷,安装都好了(post安装完成之后它要我将 相关的用户(我在这里安装的时候已指定) 添加到 agsadmin和agsusers两个用户组中.都做好了, 我甚至将刚刚的用户和用户组都删掉,重新 ...

  9. 未能在全局命名空间中找到类型或命名空间名称“Wuqi”

    下载了AspNetPager控件用以进行分页操作,在项目中放入控件后,运行报错:未能在全局命名空间中找到类型或命名空间名称“Wuqi” . 解决办法:在项目下拉框“引用“中添加AspNetPager引 ...

  10. C语言初学 if-else语句判别在ASCII值中小于32的可控制符的类型

    #include<stdio.h> main() { char c; printf("输入一个符号\n"); c=getchar(); if(c<32) prin ...