subdigital/nsscreencast — pull request #7 by alexito4 (2013-04-09 20:08:09+00:00)
Title: 047-gesture-recognizers. Solving the swipe down problem in another way.

In the episode 47 you mention that the

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

doesn't solve the swipe down problem.

You try this code:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UISwipeGestureRecognizer class]]) {
return NO;
}
return YES;}

Yes, this doesn't work. But there is a simple way to fix that. The reason is that the gesture that come in the first parameter is the pan gesture, because is the first that is detected. But then you can check if the otherGestureRecognizer is the swipe:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UISwipeGestureRecognizer class]] ||
[otherGestureRecognizer isKindOfClass:[UISwipeGestureRecognizer class]]) {
return NO;
}
return YES;}

;)