iOS UIButton - Difference between UIButton setUserInteractionEnabled and setEnabled

前端 未结 3 1604
一个人的身影
一个人的身影 2021-02-13 19:44

Wait!!!:
I know that you may think this question have been asked and answered several time before. But I can guarantee you that this questi

3条回答
  •  被撕碎了的回忆
    2021-02-13 20:11

    Characteristics of enabled:

    • It's a property of UIControl
    • Superclass for UIButton.
    • It has effects on the visual state of the object and is generally the preferred method of disabling a control

    Characteristics of userInteractionEnabled:

    • A property of UIView
    • Code that interacts with your controls is more likely to check if buttons are enabled than if their userInteractionEnabled property is set. It's more conventional.

提交回复
热议问题