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;

        }

    }

  • 相关阅读:
    3月27日
    IndiaHacks 2016
    华东交通大学2017年ACM“双基”程序设计竞赛 1003
    华东交通大学2017年ACM“双基”程序设计竞赛 1002
    华东交通大学2017年ACM“双基”程序设计竞赛 1008
    华东交通大学2017年ACM“双基”程序设计竞赛 1010
    华东交通大学2017年ACM“双基”程序设计竞赛 1001
    OpenCV3的配置(VS2015)
    Python 起步 多版本共存配置
    栈与队列试题中的操作代码
  • 原文地址:https://www.cnblogs.com/liuting-1204/p/5993033.html
Copyright © 2011-2022 走看看