Difference between enabled and Userinteractionenabled properties

Source: Internet
Author: User



I read through the documentation, and here is my findings.

< Code style= "padding:1px 5px; border:0px; White-space:pre-wrap; Background-color:rgb (238,238,238) ">uibutton  inherits from uicontrol  the boolean property enabled

< Span style= "FONT-FAMILY:SIMSUN; font-size:14px ">a Boolean value that determines whether the receiver is enabled.

S Pecify 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.

< Code style= "padding:1px 5px; border:0px; White-space:pre-wrap; Background-color:rgb (238,238,238) ">uicontrol  inherits from uiview  the boolean property userinteractionenabled :

A Boolean value that determines whether user events is ignored and removed from the event queue.

When set to NO, user Events-such as Touch and keyboard-intended for the view is ignored and removed from the event queue. When set to YES, events is 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 = NOmeans the button is grayed out and doesn ' t respond to touches (from the UIControl inheritance).


Overall, userinteractionenabled = No,view looks normal, but cannot respond to click events.

Enabled = NO, the view turns gray, and if there is text, the text becomes gray. View also cannot respond to click events.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Difference between enabled and Userinteractionenabled properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.