UITapGestureRecognizer点击手势

概述:UITapGestureRecognizer点击手势,继承于UIGestureRecognizer类,相对于UIGestureRecognizer多了两个属性值。

/*指定该手势处理器只处理几次触碰事件,默认值为1*/
@property (nonatomic) NSUInteger  numberOfTapsRequired;  
/*指定该手势处理器只处理几个手指的触碰事件,默认值为1*/
@property (nonatomic) NSUInteger  numberOfTouchesRequired __TVOS_PROHIBITED;   

案例:

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGestureAction)];
tapGesture.delegate = self;
/*手指数*/
tapGesture.numberOfTouchesRequired = 1;
/*点击次数*/
tapGesture.numberOfTapsRequired = 1;
/*加载到视图*/
[self.view addGestureRecognizer:tapGesture];

注:了解UIGestureRecognizer类请跳转https://www.jianshu.com/p/e206dc86f89a

你可能感兴趣的:(UITapGestureRecognizer点击手势)