Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.

Commit d4f20a4

Browse files
committed
Revert #259
If a custom view has a UIControl subclass, the -gestureRecognizer:shouldReceiveTouch: call is necessary to allow touches to pass through to the control immediately. Without this call, touches are delayed, and the touch up action on the control doesn't fire unless the control is tapped for an extended period of time. The call here is checking to see if the tap gesture on the DZNEmptyDataSetView should receive touches. If the tapped view is a UIControl, the gesture recognizer shouldn't receive any touches and should instead pass them along to the UIControl for processing.
1 parent b5b9216 commit d4f20a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Source/UIScrollView+EmptyDataSet.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,13 @@ - (void)swizzleIfPossible:(SEL)selector
685685

686686
#pragma mark - UIGestureRecognizerDelegate Methods
687687

688+
// This is necessary to allow touches to pass through to any UIControl that is tapped within a custom view. Otherwise,
689+
// the tap gesture on the DZNEmptyDataSetView gets the touch first which isn't the desired behaviour. The tap gesture
690+
// should only get touch events if the view that was tapped is not a UIControl
691+
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
692+
return ![touch.view isKindOfClass:[UIControl class]];
693+
}
694+
688695
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
689696
{
690697
if ([gestureRecognizer.view isEqual:self.emptyDataSetView]) {

0 commit comments

Comments
 (0)