fixes #121: merge in gesture fix from @ryanmaxwell
Showing
1 changed file
with
12 additions
and
0 deletions
@@ -1188,12 +1188,15 @@ | @@ -1188,12 +1188,15 @@ | ||
1188 | UITapGestureRecognizer *doubleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)] autorelease]; | 1188 | UITapGestureRecognizer *doubleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)] autorelease]; |
1189 | doubleTapRecognizer.numberOfTouchesRequired = 1; | 1189 | doubleTapRecognizer.numberOfTouchesRequired = 1; |
1190 | doubleTapRecognizer.numberOfTapsRequired = 2; | 1190 | doubleTapRecognizer.numberOfTapsRequired = 2; |
1191 | + doubleTapRecognizer.delegate = self; | ||
1191 | 1192 | ||
1192 | UITapGestureRecognizer *singleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)] autorelease]; | 1193 | UITapGestureRecognizer *singleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)] autorelease]; |
1193 | singleTapRecognizer.numberOfTouchesRequired = 1; | 1194 | singleTapRecognizer.numberOfTouchesRequired = 1; |
1194 | [singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer]; | 1195 | [singleTapRecognizer requireGestureRecognizerToFail:doubleTapRecognizer]; |
1196 | + singleTapRecognizer.delegate = self; | ||
1195 | 1197 | ||
1196 | UILongPressGestureRecognizer *longPressRecognizer = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)] autorelease]; | 1198 | UILongPressGestureRecognizer *longPressRecognizer = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)] autorelease]; |
1199 | + longPressRecognizer.delegate = self; | ||
1197 | 1200 | ||
1198 | [self addGestureRecognizer:singleTapRecognizer]; | 1201 | [self addGestureRecognizer:singleTapRecognizer]; |
1199 | [self addGestureRecognizer:doubleTapRecognizer]; | 1202 | [self addGestureRecognizer:doubleTapRecognizer]; |
@@ -1202,6 +1205,7 @@ | @@ -1202,6 +1205,7 @@ | ||
1202 | // two finger taps | 1205 | // two finger taps |
1203 | UITapGestureRecognizer *twoFingerSingleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerSingleTap:)] autorelease]; | 1206 | UITapGestureRecognizer *twoFingerSingleTapRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerSingleTap:)] autorelease]; |
1204 | twoFingerSingleTapRecognizer.numberOfTouchesRequired = 2; | 1207 | twoFingerSingleTapRecognizer.numberOfTouchesRequired = 2; |
1208 | + twoFingerSingleTapRecognizer.delegate = self; | ||
1205 | 1209 | ||
1206 | [self addGestureRecognizer:twoFingerSingleTapRecognizer]; | 1210 | [self addGestureRecognizer:twoFingerSingleTapRecognizer]; |
1207 | 1211 | ||
@@ -1596,6 +1600,14 @@ | @@ -1596,6 +1600,14 @@ | ||
1596 | return YES; | 1600 | return YES; |
1597 | } | 1601 | } |
1598 | 1602 | ||
1603 | +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch | ||
1604 | +{ | ||
1605 | + if ([touch.view isKindOfClass:[UIControl class]]) | ||
1606 | + return NO; | ||
1607 | + | ||
1608 | + return YES; | ||
1609 | +} | ||
1610 | + | ||
1599 | - (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer | 1611 | - (void)handlePanGesture:(UIPanGestureRecognizer *)recognizer |
1600 | { | 1612 | { |
1601 | if (recognizer.state == UIGestureRecognizerStateBegan) | 1613 | if (recognizer.state == UIGestureRecognizerStateBegan) |
-
Please register or login to post a comment