Step 1: Inertial animation judgment

Use the speed of the PAN gesture to confirm whether an inertial slide can begin

CGPoint velocity = [recognize velocityInView:recognize.view]; BOOL isTriggerDown = velocity.y > 500; BOOL isTriggerUp = Velocity. Y < -500; // Slide up to enter the next stageCopy the code

Step 2: Perform an inertial animation

The key is to use UIViewAnimationOptionBeginFromCurrentState

[UIView animateWithDuration: 0.2 delay: 0 options: UIViewAnimationOptionBeginFromCurrentState animations: ^ {/ / animation} completion:^(BOOL finished) { }];Copy the code