zoukankan      html  css  js  c++  java
  • 单双击手势

     //添加手势

    BOOL            _large;

    //双击手势

            UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];

            doubleTap.numberOfTapsRequired = 2;

            [imgView addGestureRecognizer:doubleTap];

      //单机手势    

            UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];

            singleTap.numberOfTapsRequired = 1;

            [imgView addGestureRecognizer:singleTap];

            [singleTap requireGestureRecognizerToFail:doubleTap];

    //单机手势

    - (void)singleTap:(UITapGestureRecognizer *)gesture

    {

        UIImageView *imgView = (UIImageView *)gesture.view;

        UIWindow *window = [[UIApplication sharedApplication] keyWindow];

        self.view.backgroundColor = [UIColor clearColor];

        scroll.backgroundColor = [UIColor clearColor];

        [window addSubview:imgView];

        [imgView removeFromSuperview];

        [self dismissViewControllerAnimated:NO completion:nil];

    }

    - (void)doubleTap:(UITapGestureRecognizer *)gesture

    {

        UIScrollView *scl = (UIScrollView *)gesture.view.superview;

        

        if (scl.zoomScale == scl.maximumZoomScale) {

            

            [scl setZoomScale:1.0 animated:YES];

            _large = NO;

            _zoomingScrollView = nil;

            return;

        }

        

        if (_large) {

            

            [scl setZoomScale:1.0 animated:YES];

            _large = NO;

            _zoomingScrollView = nil;

            

        }else{

            

            CGPoint location = [gesture locationInView:gesture.view];

            [scl zoomToRect:CGRectMake(location.x, location.y, 1, 1) animated:YES];

            _large = YES;

            _zoomingScrollView = scl;

        }

    }

  • 相关阅读:
    BZOJ 1101 莫比乌斯函数+分块
    BZOJ 2045 容斥原理
    BZOJ 4636 (动态开节点)线段树
    BZOJ 2005 容斥原理
    BZOJ 2190 欧拉函数
    BZOJ 2818 欧拉函数
    BZOJ 3123 主席树 启发式合并
    812. Largest Triangle Area
    805. Split Array With Same Average
    794. Valid Tic-Tac-Toe State
  • 原文地址:https://www.cnblogs.com/liuting-1204/p/5993033.html
Copyright © 2011-2022 走看看