您的位置:首页 > 移动开发 > Swift

Swift中实现点击、双击、捏、旋转、拖动、划动、长按手势的类和方法介绍

2015-01-09 12:46 1421 查看
   var longpressGesutre = UILongPressGestureRecognizer(target: self, action: "handleLongpressGesture:")      //长按时间      // longpressGesutre.minimumPressDuration     //所需触摸次数     /// 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 }

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐