The general use order / probability of occurrence for a normal button is listed, as I consider it:
UIControlEventTouchDown : user clicked a button. This works when a finger / stylus contacts.
UIControlEventTouchUpInside : user clicked a button. This is triggered by a finger / stylus contact pushed back from the screen.
Useful for sliders and drag and drop events such as moving a component. The following are listed in order of appearance:
UIControlEventTouchDragInside : Fires when you drag your finger to the button area.
UIControlEventTouchDragExit : Fires during a drag motion. It is called only once, since the user's finger / stylus extends beyond the button.
UIControlEventTouchDragOutside : Fires during a drag movement after 'UIControlEventTouchDragExit' and is called continuously while the initial touch continues.
UIControlEventTouchUpOutside : This is just a tap of a finger / stylus, BUT only if the finger / stylus is no longer within the button. The important thing (and probably obvious) that needs to be called is that the touch had to be inside the button at some point in order to associate this event with the button.
Note: I understand that the above may be useful for:
- Sliders: as you would expect, touching might be deliberate, but due to the quick action of the finger, the movement of their fingers may be inaccurate and rise beyond the area of the slider.
- Moving components, for example, when you move objects around the screen, you want the movement to occur when the finger / stylus touches the border of the component / object.
Other events:
UIControlEventTouchCancel : Something from the user control cancels the touch action. Think of it as something “wrong” on the phone side.
UIControlEventTouchDownRepeat : Want to determine when your user is angry and furiously clicks a button? Want to determine if they are in Windows mode and trying to double-click? Or maybe you designed a button to do something else if they click twice. This event helps with all this!
Recommendations:
SO 1 : difference between UIControlEventTouchDragOutside and UIControlEventTouchDragExit
SO 2 : What is a UIControlEventTouchCancel?
Dave G Apr 28 '19 at 23:42 on 2019-04-28 23:42
source share