UIControlEventTouchUpInside is fired even when an UIButton is disabled

Originator:corrmage
Number:rdar://42378576 Date Originated:July 19 2018, 2:21 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.4
Classification:Other Bug Reproducible:Always
 
Summary:
If UIControlEventTouchDownInside occurs while the button is still enabled, UIControlEventTouchUpInside would be fired even if the button was disabled between tapping & releasing the button.

Steps to Reproduce:
1. Open the attached sample project.
2. Build & Run app.
3. Tap & hold the button before it becomes disabled (it’s disable after 3 seconds)
4. Release the button

Expected Results:
No alerts displayed.

Actual Results:
An alert saying “TouchUpInside” is displayed.

Version:
11.4

Notes:
Initially I observed the issue with UIBarButtonItem.

I believe that this behavior violates the UIControl.enabled property contract stated in the docs, namely the following part (emphasis mine):

>>>Set the value of this property to YES to enable the control or NO to disable it. An enabled control is capable of responding to user interactions, whereas a disabled control *ignores touch events* and may draw itself differently.

iOS 12 betas at the time of writing are also affected.

Configuration:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!