码迷,mamicode.com
首页 > 其他好文 > 详细

UIView上的滑动手势及动作

时间:2014-08-01 22:40:02      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:os   io   art   cti   ar   div   log   ui   

 
  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. }  

UIView上的滑动手势及动作,布布扣,bubuko.com

UIView上的滑动手势及动作

标签:os   io   art   cti   ar   div   log   ui   

原文地址:http://www.cnblogs.com/ranger-jlu/p/3885748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!