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. }  
  • 相关阅读:
    js将url转换二维码
    百度地图api使用
    js字符串转日期兼容性
    Object.keys的使用
    Web App和Native App的比较
    数组转为对象
    常用meta整理
    git merge和git rebase的区别
    GitHub 翻译之 'Hello-world' 翻译
    js数据类型
  • 原文地址:https://www.cnblogs.com/ranger-jlu/p/3885748.html
Copyright © 2011-2022 走看看