A simpler alternative to the UIDynamicAnimator in iOS 7 is Spring Animation (a new and powerful UIView block animation) that can give you a nice bounce effect with fade and speed: Target C
[UIView animateWithDuration:duration delay:delay usingSpringWithDamping:damping initialSpringVelocity:velocity options:options animations:^{ //Animations } completion:^(BOOL finished) { //Completion Block }]
Swift
UIView.animateWithDuration(duration, delay: delay, usingSpringWithDamping: damping, initialSpringVelocity: velocity, options: options, animations: { //Do all animations here }, completion: { //Code to run after animating (value: Bool) in })
usingSpringWithDamping 0.0 == very peppy. 1.0 provides smooth deceleration without exceeding.
initialSpringVelocity , roughly speaking, "the desired distance divided by the desired seconds." 1.0 corresponds to the total animation distance traveled in one second. For example, the total animation distance is 200 points, and you want the start of the animation to correspond to a viewing speed of 100 pps, use a value of 0.5.
A more detailed guide and sample application can be found in this tutorial . Hope this is useful to someone.
friedegg-bacon-sandwich May 7 '14 at 10:01 a.m. 2014-05-07 10:01
source share