UISwipeGestureRecognizer * swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeGesture:)];


     轻扫方向
     UISwipeGestureRecognizerDirectionRight
     UISwipeGestureRecognizerDirectionLeft
     UISwipeGestureRecognizerDirectionUp
     UISwipeGestureRecognizerDirectionDown
   

   

设置轻扫方向,让左右方向都存在 只要枚举值中又左移运算符,代表枚举值可以通过按位或 | 让多个枚举值存在
   

warning :::::上下 和左右方向 在一个手势识别器中不能同时存在
 

如果想要上下左右四个方法都有,就要创建两个轻扫手势对象,一个支持上下,一个支持左右.

   swipeGesture.direction =  UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight ;

   [redView addGestureRecognizer:swipeGesture];

   [swipeGesture release];



- (void)swipeGesture :(UISwipeGestureRecognizer *)swipeGesture
{
    NSLog(@"%u", swipeGesture.direction);
    swipeGesture.view.backgroundColor = [UIColor random];
}