UISwipeGestureRecognizer (手指在屏幕上滑动操作手势)

Posted on 2014-02-28 16:56  cillyfly  阅读(682)  评论(0编辑  收藏  举报

 // 滑动手指的个数

numberOfTouchesRequired

// 手指滑动的方向 (Up,Down,Left,Right)

direction

 

  1. UISwipeGestureRecognizer *swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] init];  
  2. [swipeGestureRecognizer addTarget:self action:@selector(gestureRecognizerHandle:)];  
  3. [swipeGestureRecognizer setNumberOfTouchesRequired:2];  
  4. [swipeGestureRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];  
  5. [self.view addGestureRecognizer:swipeGestureRecognizer];  
  6. [swipeGestureRecognizer release]; 
 
//这个也可以直接在storyboard中实现
 
2.在设置页面进行设置
   
 
这样就可以不通过代码来实现页面之间的切换方式