Where is the difference between UIControlEventTouchDragOutside and UIControlEventTouchDragExit?

Both have the same effect. They come when the finger is far enough out of control. "Boundaries" are not really the criteria for UIControlEventTouchDragExit. He's only fired if he's far enough ...

+2


source to share


2 answers


UIControlEventTouchDragOutside Event where the finger is dragged directly outside the control.

UIControlEventTouchDragExit Event in which a finger is dragged from within the control outside of its bounds.



It looks like with UIControlEventTouchDragOutside is triggered when the user only touches out of bounds, regardless of whether the finger was ever within bounds. UIControlEventTouchDragExit only fires when you drag your finger from bounds to bounds.

So UIControlEventTouchDragOutside will be used when the control is resized (short press and then dragging), while UIControlEventTouchDragExit will be used to move the control (click inside and drag).

+6


source


I came here looking for the same thing and the answer from eOgas didn't seem accurate. I made my own test case and here are my results for those who want a detailed answer without testing it for themselves:

UIControlEventTouchDragExit

  • called only once, when the user leaves the control they clicked on. When the user violates the "magic border" * outside the UIButton (for example), this event is fired once. If, while dragging, the user returns to the control and returns again, this event is raised again. The opposite may be true for UIControlEventTouchDragEnter .

UIControlEventTouchDragOutside



  • gets called after UIControlEventTouchDragExit and gets called again every time the user drags their finger, while retaining the original touch that was used to enter the control. For those familiar with the touchhesMoved UIView method , it works similarly. The opposite may be true for UIControlEventTouchDragInside , however this can obviously be called without leaving control first.

To understand or remember better, you can compare these events to someone who leaves (and comes) to their house, where they only leave the house once and then move to the outside repeatedly. In addition, one person enters their home once, but then re-moves inside .

* extra space around the UIControl object to accommodate the user's potential for imprecise strokes.

+12


source







All Articles