创建只有上下或者左右手势的UIPanGestureRecognizer
- PanGesture.h
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, PanDirection) {
PanDirectionVertical,
PanDirectionHorizontal,
};
@interface PanGesture : UIPanGestureRecognizer
@property (nonatomic, assign) PanDirection direction;
@end
NS_ASSUME_NONNULL_END
- PanGesture.m
#import "PanGesture.h"
NSInteger const