Search code examples
objective-cuislider

Prevent UISlider from firing UIControlEventValueChanged event when releasing thumb


When observing the UIControlEventValueChanged event on a UISlider, I noticed that this event is again fired when releasing the thumb. I cannot circumvent this second firing via UIControlEventTouchUpInside since the value UIControlEventValueChanged event has already fired. Is there a way to prevent this second firing of UIControlEventValueChanged when releasing the thumb? Or is there a way to cancel all in progress touches on the slider?


Solution

  • When observing the UIControlEventValueChanged event, touch-downs->drags->touch-ups are received.

    When needing to captures these events separately I had to observe: UIControlEventTouchDown -> UIControlEventTouchDragInside | UIControlEventTouchDragOutside -> UIControlEventTouchUpInside | UIControlEventTouchUpOutside