在View上添加一个单击手势及其响应事件,如果有写
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
会先响应touchesBegan,再响应单击手势的事件。
要阻止touchesBegan的响应,只需要将手势的delaysTouchesBegan属性设置为Yes。
避免在识别出点击手势之前出发touches手势
@property(nonatomic) BOOL delaysTouchesBegan;
// default is NO. causes all touch or press events to be delivered to
the target view only after this gesture has failed recognition. set to
YES to prevent views from processing any touches or presses that may be
recognized as part of this gesture