• 单双击手势


     //添加手势

    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;

        }

    }

  • 相关阅读:
    服务级后门自己做——创建服务
    使用Win32创建串口通讯程序
    LoadImage with resource 出现未定义
    direct path write等待事件
    enq: TX row lock/index contention、allocate ITL等待事件
    enq: TT contention等待事件
    enq: TM contention等待事件
    enq: RO fast object reuse等待事件
    direct path write temp等待事件
    enq: US contention等待事件
  • 原文地址:https://www.cnblogs.com/liuting-1204/p/5993033.html
Copyright © 2020-2023  润新知