如果你的UIView加上了Tap Gesture,同时这个UIView放上一个UIButton那么当你点击这个UIButton的时候,调用的是Gesture的Action,那么如何解决这个问题呢?
很简单,就是判断如果Gesture是点击到按钮上的,那么就不响应,那么这时候直接就进入了UIButton的Action.
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
// Disallow recognition of tap gestures in the segmented control.
if ((touch.view == your button)) {//change it to your condition
return NO;
}
returnYES;
}