稳定的动画?

时间:2011-12-15 20:02:18

标签: objective-c commitanimations

我正在制作带有光标和音乐的iPhone / iPad应用程序。我正在为每个节拍运行一个计时器,并像这样移动它:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:theLength];
[UIView setAnimationBeginsFromCurrentState:YES];
theCursor.frame = CGRectMake(theX, 0, 6, 320);
[UIView commitAnimations];

然而,它似乎开始快速然后放慢速度,直到它结束。有什么办法让动画稳定吗?

1 个答案:

答案 0 :(得分:4)

这就是动画曲线。默认情况下,它设置为UIViewAnimationCurveEaseInOut。使用setAnimationCurve:将其设置为UIViewAnimationCurveLinear

您还应该注意,不推荐使用这种动画方式,Apple现在建议使用基于块的动画样式。

相关问题