- ///////////注flowView为UIView//////////
- //添加滑动手势事件
- UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:flowView action:@selector(handleGesture:)];
- [flowView addGestureRecognizer:gestureRecognizer];
- //添加点击手势事件
- flowView.userInteractionEnabled = YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:flowView action:@selector(goBigImageView)];
- [flowView addGestureRecognizer:tap];
- //滑动手势(里面有手势的不同状态,根据需要进行灵活运用)
- - (void)handleGesture:(UIPanGestureRecognizer *)recognizer {
- //UITapGestureRecognizer
- if (recognizer.state == UIGestureRecognizerStateChanged){
- NSLog(@"UIGestureRecognizerStateChanged");
- }else if(recognizer.state == UIGestureRecognizerStateEnded){
- NSLog(@"UIGestureRecognizerStateEnded");
- }else if(recognizer.state == UIGestureRecognizerStateBegan){
- NSLog(@"UIGestureRecognizerStateBegan");
- }else if(recognizer.state == UIGestureRecognizerStateCancelled){
- NSLog(@"UIGestureRecognizerStateCancelled");
- }else if(recognizer.state == UIGestureRecognizerStateFailed){
- NSLog(@"UIGestureRecognizerStateFailed");
- }else if(recognizer.state == UIGestureRecognizerStatePossible){
- NSLog(@"UIGestureRecognizerStatePossible");
- }else if(recognizer.state == UIGestureRecognizerStateRecognized){
- NSLog(@"UIGestureRecognizerStateRecognized");
- }
- }