UIControl各种UITouch事件及Edit事件的触发条件
1、public static var touchDown: UIControlEvents { get } // on all touch downs
touchDown:按下,指单点触摸按下事件
2、 public static var touchDownRepeat: UIControlEvents { get } // on multiple touchdowns (tap count > 1)
多次连续触摸按下事件,指双击,三击,四击或多击;多次连续触摸按下事件的执行顺序:
touchDown=>allTouchEvents=>allEvents=>touchUpInside=>allTouchEvents=>allEvents=>primaryActionTriggered=>allEvents=>
touchDown=>allTouchEvents=>allEvents=>touchDownRepeat=>allTouchEvents=>allEvents=>touchUpInside=>allTouchEvents=>allEvents=>primaryActionTriggered=>allEvents=>
touchDown=>allTouchEvents=>allEvents=>touchDownRepeat=>allTouchEvents=>allEvents=>touchUpInside=>allTouchEvents=>allEvents=>primaryActionTriggered=>allEvents=>
…
除了第一次按下外,后面每一次按下触发touchDown之后会紧接着触发touchDownRepeat事件
3、 public static var touchDragInside: UIControlEvents { get }
指鼠标在控件边缘内拖动,拖动时会连续不断触发该事件
4、public static var touchDragOutside: UIControlEvents { get }
指鼠标从控件边缘内拖动到边缘外后,会连续不断触发,其触发顺序
touchDown…=>touchDragInside(多次)…=>touchDragExit…=>touchDragOutside(多次)…
(为了看的更清楚,…把=>allTouchEvents=>allEvents等事件忽略掉了。因为懒,所以下面不再做解释)
5、 public static var touchDragEnter: UIControlEvents { get }
指从控件外拖拽到控件内会触发一次的事件,若想触发该事件,必先从控件内拖拽到控件外,然后再拖拽到控件内才会触发;若仅仅从控件外按下拖拽到控件内并不会触发该控件的任何事件。其触发顺序
touchDown…=>touchDragInside(多次)…=>touchDragExit…=>touchDragOutside(多次)…=>touchDragEnter...=>touchDragInside(多次)
6、public static var touchDragExit: UIControlEvents { get }
从控件内拖拽到控件外会触发一次的事件,其触发顺序
touchDown…=>touchDragInside(多次)…=>touchDragExit…=>touchDragOutside(多次)…
7、public static var touchUpInside: UIControlEvents { get }
指手指从控件范围内抬起会触发一次的事件,该事件之前必会先触发
8、public static var touchUpOutside: UIControlEvents { get }
指手指从控件范围外抬起会触发一次的事件,触发该事件必先从控件内按下,然后拖拽至控件外抬起,才会触发.其触发顺序
touchDown…=>touchDragInside(多次)…=>touchDragExit…=>touchDragOutside(多次)…=>touchUpOutside
9、public static var touchCancel: UIControlEvents { get }
所有触摸取消事件,即一次触摸因为放上了太多手指而被取消,或者被锁屏或者电话呼叫打断.
10、 public static var valueChanged: UIControlEvents { get } // sliders, etc.
当控件的值发生改变时会触发的事件。用于滑块、分段控件、以及其他取值的控件。你可以配置滑块控件何时发送通知,在滑块被放下时发送,或者在被拖动时触发
11、@available(iOS 9.0, *)
public static var primaryActionTriggered: UIControlEvents { get } // semantic action: for buttons, etc.
还未搞清楚该事件的准确触发条件,但每次从控件内抬起,都会触发该事件.
12-15是可编辑控件(继承自UIControl)的编辑事件.
12、public static var editingDidBegin: UIControlEvents { get } // UITextField
已经开始编辑时会触发一次的事件
13、public static var editingChanged: UIControlEvents { get }
编辑内容改变后会触发
14、 public static var editingDidEnd: UIControlEvents { get }
结束编辑后时触发
15、 public static var editingDidEndOnExit: UIControlEvents { get } // 'return key' ending editing
当文本控件内通过按下回车键(或等价行为)结束编辑时,发送通知。
16、 public static var allTouchEvents: UIControlEvents { get } // for touch events
所有的触摸事件都会触发该事件
17、public static var allEditingEvents: UIControlEvents { get } // for UITextField
所有关于文本编辑的事件会触发该事件
18、public static var allEvents: UIControlEvents { get }
所有事件都会触发