I have a method that drags me a view as I slide my finger on the screen. For this I use UIPanGestureRecognizer
.
In the method I increase the position x
of the view point to point, but I'm interested in moving it according to the speed with which I move my finger. If I slowly move the movement if it fits if I do it point by point but if I slide more quickly the increments I do not know how to do them. I have tried with the locationInView
or velocity method of UIPanGestureRecognizer
but I have not implemented it well.
CGPoint touchLocation = [panGestureRecognizer locationInView:self.view];
CGPoint velocity = [panGestureRecognizer velocityInView:self.view];
posX = posX + 1;
self.view
would be the main view, posx
is the position of the view that I move according to the event.