手势

来源:互联网 发布:数据恢复吧 编辑:程序博客网 时间:2024/05/01 16:32

    // 手势

    

    // 点击

    

//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAciton:)];

//    tap.numberOfTapsRequired = 2;

//    tap.numberOfTouchesRequired = 2;

//    [imageView addGestureRecognizer:tap];

//    [tap release];

    

    

    

    

    // 长按

    

    

    UILongPressGestureRecognizer *longPress= [[UILongPressGestureRecognizeralloc] initWithTarget:selfaction:@selector(longPressAction:)];

    [imageView addGestureRecognizer:longPress];

    [longPress release];

    longPress.minimumPressDuration =1;

    longPress.allowableMovement = 200;

//    longPress.numberOfTapsRequired = 2;        // 双击之后长按

//    longPress.numberOfTouchesRequired = 2;

    

    

    

    

    // 轻扫

    

    

//    UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];

//    [imageView addGestureRecognizer:swipeRight];

//    [swipeRight release];

//    swipeRight.direction = UISwipeGestureRecognizerDirectionRight;


    //    UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];

//    [imageView addGestureRecognizer:swipeLeft];

//    [swipeLeft release];

//    swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;


    //    UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];

//    [imageView addGestureRecognizer:swipeUp];

//    [swipeUp release];

//    swipeUp.direction = UISwipeGestureRecognizerDirectionUp;


    //    UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeAction:)];

//    [imageView addGestureRecognizer:swipeDown];

//    [swipeDown release];

//    swipeDown.direction = UISwipeGestureRecognizerDirectionDown;

    

    

    

    // 旋转

    

    

//    UIRotationGestureRecognizer *rotation = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotationAction:)];

//    

//    [imageView addGestureRecognizer:rotation];

//    [rotation release];

//    

    

    

    

    // 捏合

    

    UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizeralloc] initWithTarget:selfaction:@selector(pinchAction:)];

    [imageView addGestureRecognizer:pinch];

    [pinch release];

   //pinch.scale 放大缩小的倍数

//

    

    

    // 拖拽

    

    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizeralloc] initWithTarget:selfaction:@selector(panAction:)];

    [imageView addGestureRecognizer:pan];

    [pan release];


0 0
原创粉丝点击