I’m dragging an imageView around the screen which is working great. At the moment, it is evaluating an if statement every time the image is moving, but I would like it to check it once the user has lifted their finger off the screen. How would I go about this? I thought maybe using touchesEnded:withEvent but it didn’t look like it was being called when lifting the finger.
My code is a little complicated (well, it looks that way to me!) but if that is helpful, I will post it. Basically, in the handlePanGesture method, it is checking the co-ordinates against a dictionary and if it is true, will ‘snap’ to the correct position. The reason I want to check when the user has lifted is because, if they have dropped it in the wrong place, I’d like to animate it back to the original position.
Many thanks for reading this.
I’m dragging an imageView around the screen which is working great. At the moment,
Share
I think you need to check the state of the gesture recognizer in your action method, gestureRecognizer.state == UIGestureRecognizerStateEnded. It’s my understanding that you only use touchesEnded:withEvent if you are subclassing the geture recognizer.