1.UITapGestureRecognizer 點(diǎn)擊/雙擊手勢(shì)
var tapGesture = UITapGestureRecognizer(target: self, action: "handleTapGesture:")
//設(shè)置手勢(shì)點(diǎn)擊數(shù),雙擊:點(diǎn)2下
tapGesture.numberOfTapsRequired = 2
self.view.addGestureRecognizer(tapGesture)
2.UIPinchGestureRecognizer 捏 (放大/縮小)手勢(shì)
var pinchGesture = UIPinchGestureRecognizer(target: self, action: "handlePinchGesture:")
self.view.addGestureRecognizer(pinchGesture)
3.UIRotationGestureRecognizer 旋轉(zhuǎn)手勢(shì)
var rotateGesture = UIRotationGestureRecognizer(target: self, action: "handleRotateGesture:")
self.view.addGestureRecognizer(rotateGesture)
4. UIPanGestureRecognizer 拖動(dòng)手勢(shì)
var panGesture = UIPanGestureRecognizer(target: self, action: "handlePanGesture:")
self.view.addGestureRecognizer(panGesture)
5. UISwipeGestureRecognizer 劃動(dòng)手勢(shì)
var swipeGesture = UISwipeGestureRecognizer(target: self, action: "handleSwipeGesture:")
swipeGesture.direction = UISwipeGestureRecognizerDirection.Left //不設(shè)置是右
self.view.addGestureRecognizer(swipeGesture)
6. UILongPressGestureRecognizer 長按手勢(shì)
var longpressGesutre = UILongPressGestureRecognizer(target: self, action: "handleLongpressGesture:")
//長按時(shí)間
// longpressGesutre.minimumPressDuration
//所需觸摸次數(shù)
/// longpressGesutre.numberOfTouchesRequired
self.view.addGestureRecognizer(longpressGesutre)
UIGestureRecognizerState 枚舉定義如下
enum UIGestureRecognizerState : Int {
case Possible // the recognizer has not yet recognized its gesture, but may be evaluating touch events. this is the default state
case Began // the recognizer has received touches recognized as the gesture. the action method will be called at the next turn of the run loop
case Changed // the recognizer has received touches recognized as a change to the gesture. the action method will be called at the next turn of the run loop
case Ended // the recognizer has received touches recognized as the end of the gesture. the action method will be called at the next turn of the run loop and the recognizer will be reset to UIGestureRecognizerStatePossible
case Cancelled // the recognizer has received touches resulting in the cancellation of the gesture. the action method will be called at the next turn of the run loop. the recognizer will be reset to UIGestureRecognizerStatePossible
case Failed // the recognizer has received a touch sequence that can not be recognized as the gesture. the action method will not be called and the recognizer will be reset to UIGestureRecognizerStatePossible
}



















