I have a UIButton with 2 functions: tap, and long press. A bit like the Springboard app (home screen). I’ve implemented it as a UIButton with a UILongPressGestureRecognizer attached.
In some cases I need to disable the tap action which i do by setting enabled = NO on my button. But unfortunately this also disabled my gesture recogniser.
How do I disable the UIButton’s standard behaviour while keeping the gesture recogniser attached to it active?
UIButton is a sub-class of UIControl.
Look at the various methods in UIControl.
You can specify specific methods to call for ControlEvents (such as ControlEventTouchUpInside a.k.a tap) and for UIEvents.
You can remove actions for control events with:
Or, depending on your conditions, you can just no-op inside the target/selector method that is called.