IOS drag objects with inertia

I start with gestures in iOS, and I don't know how to add inertia to my movements. Like gestures in a gesture.

At this point, I can move objects using this type of recognizer, but I need a small physics system similar to the scroll view effect.

Can anybody help me? Thank you very much

+4
source share
1 answer

When you use UIPanGestureRecognizer , you have translationInView: and velocityInView: speed is the speed at which the user moves his finger, in pixels per second. You can use the speed to determine the inertia that the user "gives" the view when their finger rises (the state of the recognizer is UIGestureRecognizerStateEnded ).

+5
source

All Articles