如何为UIView animateWithDuration添加跳出效果 [英] How do I add a bounce effect to UIView animateWithDuration
本文介绍了如何为UIView animateWithDuration添加跳出效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为下面的动画添加一个反弹效果。这是我的代码:
I am trying to add a bounce effect to the animation below. Here is my code:
[UIView animateWithDuration:1.0
delay:.0
usingSpringWithDamping:0.5
initialSpringVelocity:2.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
// Coming from a value of CGAffineTransformMakeScale(0.001, 1.0)
self.myView.transform = CGAffineTransformMakeScale(1.0, 1.0);
}completion:nil
];
它无法正常工作。它在动画结束时变宽,然后恢复正常。我希望宽度反弹到小于1.0的值,不超过1.0。
It's not working correctly. It becomes wider at the end of the animation then it goes back to normal. I want the width to bounce to a lesser value than 1.0, not more than 1.0.
推荐答案
从iOS 7开始,动态动画有更好的实现方式。研究这个 Apple的示例代码或者来自 Ray Wenderlich 。
Dynamic animations have better ways to implement since iOS 7. Study this Sample code from Apple or from Ray Wenderlich.
这篇关于如何为UIView animateWithDuration添加跳出效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文