UIView 动画持续时间: 持续时间: 动画: 完成: 似乎有一个默认过渡



在我的程序中,我想创建一个以恒定速度移动的动画。动画似乎开始缓慢,加速,然后缓慢完成。有什么办法可以改变这一点吗?

您可以使用

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
    }];

最新更新