zoukankan      html  css  js  c++  java
  • UIView上的滑动手势及动作

     
    1. ///////////注flowView为UIView//////////  
    2.  //添加滑动手势事件  
    3.     UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:flowView action:@selector(handleGesture:)];  
    4.     [flowView addGestureRecognizer:gestureRecognizer];  
    5.       
    6.     //添加点击手势事件  
    7.     flowView.userInteractionEnabled = YES;  
    8.     UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:flowView action:@selector(goBigImageView)];  
    9.     [flowView addGestureRecognizer:tap];  
     
    1. //滑动手势(里面有手势的不同状态,根据需要进行灵活运用)  
    2. - (void)handleGesture:(UIPanGestureRecognizer *)recognizer {  
    3.     //UITapGestureRecognizer  
    4.    if (recognizer.state == UIGestureRecognizerStateChanged){  
    5.        NSLog(@"UIGestureRecognizerStateChanged");  
    6.    }else if(recognizer.state == UIGestureRecognizerStateEnded){  
    7.        NSLog(@"UIGestureRecognizerStateEnded");  
    8.    }else if(recognizer.state == UIGestureRecognizerStateBegan){  
    9.        NSLog(@"UIGestureRecognizerStateBegan");  
    10.    }else if(recognizer.state == UIGestureRecognizerStateCancelled){  
    11.        NSLog(@"UIGestureRecognizerStateCancelled");  
    12.    }else if(recognizer.state == UIGestureRecognizerStateFailed){  
    13.        NSLog(@"UIGestureRecognizerStateFailed");  
    14.    }else if(recognizer.state == UIGestureRecognizerStatePossible){  
    15.        NSLog(@"UIGestureRecognizerStatePossible");  
    16.    }else if(recognizer.state == UIGestureRecognizerStateRecognized){  
    17.        NSLog(@"UIGestureRecognizerStateRecognized");  
    18.    }  
    19.   
    20. }  
  • 相关阅读:
    python学习笔记之--read、readline和readlines
    目录操作习题
    递归习题
    文件操作练习题
    HandleBase句柄的5种写法
    ContextBase
    BasegoSort
    PrototypePra原型_设计订单保存
    DesignPattenTemplate模板模式
    DesignPattenStrategy策略模式
  • 原文地址:https://www.cnblogs.com/ranger-jlu/p/3885748.html
Copyright © 2011-2022 走看看