在我的程序中,我想创建一个以恒定速度移动的动画。动画似乎开始缓慢,加速,然后缓慢完成。有什么办法可以改变这一点吗?
animateWithDuration:delay:options:animations:completion:
替代方法更改此设置。发送选项参数的UIViewAnimationOption
掩码。这些是您感兴趣的选项:
UIViewAnimationOptionCurveEaseInOut
UIViewAnimationOptionCurveEaseIn
UIViewAnimationOptionCurveEaseOut
UIViewAnimationOptionCurveLinear
文档指出UIViewAnimationOptionCurveEaseInOut
是默认值。
有关更多详细信息,请参阅文档:http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html
使用,这将解决你的问题
[UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
//code with animation
} completion:^(BOOL finished) {
//code for completion
}];