With the code that you showed, you need to have logic to start the animation when the gesture recognizer is canceled, and I would say that this is not so good, because there are other ways in which this gesture recognizer can be canceled without wanting to make the animation.
Given that you have a way to start the animation, you just need to call this method when the threshold is passed and when the gesture ends normally. Then two different cases. The code you submit will look like this:
if (translation.y > 100) { // do action [self finishFlip]; sender.enabled = NO; sender.enabled = YES; }
Undoing gestures here can also be useful if it prevents any of the following actions if the user continues to drag his finger.
If you have a team developing on this subject, and you need a specific event, you should subclass the gesture recognizer, as suggested by nont.
FΓ‘bio oliveira
source share