摆脱自动轻松进出

时间:2014-08-04 22:36:42

标签: ios objective-c animation uiview

我试图让一个物体以稳定的速度从屏幕的一侧移动到另一侧。每当我使用下面的代码行时,对象会慢慢开始移动,然后当它在屏幕中间时以最快的速度运行,最后减速直到它到达屏幕的另一侧。换句话说,它正在进行轻松和轻松。这是我正在使用的代码。

[UIView animateWithDuration:3.0 animations:^{ circle.center = CGPointMake(0, 0);}];

关于如何让物体以稳定的速度移动的任何想法?

1 个答案:

答案 0 :(得分:2)

使用以下方法

+ (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;

使用UIViewAnimationCurveLinear作为选项参数。

相关问题