Sunday 15 January 2012

ios - Which is better, setEnabled or setUserInteractionEnabled? -


I want to disable a UIButton for the user code. Both the setEnabled and setUserInteractionEnabled can do that well? How are they different?

enabled is an property of UIControl , Which is a superclass for UIButton . There is a property of userInteractionEnabled UIView (which is the superclass of UIControl ). The effect of the enabled object has an effect on the visual state (by default, gray), and generally the preferred way of disabling one control is to show the signal of the audience is a good thing.

The code that interacts with your controls is more likely to check whether buttons are enabled if their user interaction enabled properties are set; This is more traditional

No comments:

Post a Comment