天天看点

触摸与手势学习-swift

触摸是一个UITouch对象,该对象放在一个UIEvent中,每个UIEvent包含一个或多个UITouch对象,每个UITouch对象对应一个手指。系统将UIEvent发送到应用程序上,最后应用程序将UIEvent传递给当前的一个UIView。

触摸分为5个阶段:

1)Began

2)Moved

3)Stationary

4)Ended

5)Cancelled(比如收到电话)

手势UIGestureRecognizer:

UITapGestureRecognizer

UIPanGestureRecognizer

UILongPressGestureRecognizer

UIPinchGestureRecognizer

UISwipeGestureRecognizer