I'm looking for some input here, what's the best way to go about this.
I have a slideshow controller, a bunch of UIImageViews along a UIScrollView.
I can scroll right and left using swipes but when I single tap I start a NSTimer based slideshow that scrolls the view so much every repeat. another single tap invalidates the timer.
The problem is that the user can still swipe the screen and it messes up the slideshow animation.
I need to be able to discard any gesture that is not a tap. I can't disable userinteraction, I can't disable scrolling.
I have tried to disable all gestures that aren't tap recognizers
I have tried to create a generic gesture and have that fail all but taps
I have a slideshow controller, a bunch of UIImageViews along a UIScrollView.
I can scroll right and left using swipes but when I single tap I start a NSTimer based slideshow that scrolls the view so much every repeat. another single tap invalidates the timer.
The problem is that the user can still swipe the screen and it messes up the slideshow animation.
I need to be able to discard any gesture that is not a tap. I can't disable userinteraction, I can't disable scrolling.
I have tried to disable all gestures that aren't tap recognizers
Code:
for (UIGestureRecognizer * gestureRecognizer in [self.scrollView gestureRecognizers]) {
if (![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
[gestureRecognizer setEnabled:NO];
}
}
I have tried to create a generic gesture and have that fail all but taps
Code:
for (UIGestureRecognizer * gestureRecognizer in [self.scrollView gestureRecognizers]) {
if (![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
[gestureRecognizer requireGestureRecognizerToFail:self.gesture];
}
}