Search code examples
iosios9uigesturerecognizeruiswipegesturerecognizer

UISwipeGestureRecognizer state always Ended


I'm trying to make a custom interactive transition triggered by a UISwipeGestureRecognizer but the state is always UIGestureRecognizerStateEnded, so I can't use it to control the animation.

Apple's documentation says Some of these states are not applicable to discrete gestures but they don't say which states are available to UISwipeGestureRecognizer. [https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIGestureRecognizer_Class/index.html#//apple_ref/occ/instp/UIGestureRecognizer/state]

Does UISwipeGestureRecognizer only have one state or am I doing something wrong?


Solution

  • Swipe gestures aren't continuous. When they recognize a swipe, they fire and then they're done. If you want a transition that happens as you slide your finger, you need to use a pan gesture recognizer.