The docs say
The velocity of the pan gesture, which is expressed in points per second. The velocity is broken into horizontal and vertical components.
So I’d say, given you want to move your view xPoints
(measured in pt) to let it go off-screen, you could calculate the duration for that movement like so:
CGFloat xPoints = 320.0;
CGFloat velocityX = [panRecognizer velocityInView:aView].x;
NSTimeInterval duration = xPoints / velocityX;
CGPoint offScreenCenter = moveView.center;
offScreenCenter.x += xPoints;
[UIView animateWithDuration:duration animations:^{
moveView.center = offScreenCenter;
}];
You might want to use + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion
instead though and try out different UIViewAnimationOptions
.