UIView动画移动

时间:2014-04-29 22:27:41

标签: ios animation uiview

我设法让“视图”移动一次。我需要它在同一个地方停留1 second,然后再回到初始位置。我如何为此添加其余代码? (这不会是循环,只进行一次)

[UIView animateWithDuration:0.8 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        [infoView setCenter:CGPointMake(160,30)];
    } completion:nil];

1 个答案:

答案 0 :(得分:2)

使用完成块执行另一个动画:

[UIView animateWithDuration:0.8 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
    [infoView setCenter:CGPointMake(160,30)];
} completion:^(BOOL finished) {
    [UIView animateWithDuration:0.8 delay:1 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        [infoView setCenter:CGPointMake(orignalX, originalY)];
    } completion:nil];
}];