【问题标题】:UIView Animation MoveUIView 动画移动
【发布时间】:2014-04-29 22:27:40
【问题描述】:

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

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

【问题讨论】:

    标签: ios animation uiview


    【解决方案1】:

    使用完成块做另一个动画:

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

    【讨论】:

    • 我收到一个错误:不兼容的块指针类型将“void(^)(void)”发送到“void (^)(BOOL)”类型的参数
    • 已修复 - 我有一个错字。
    • 谢谢!效果很好!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-31
    • 2018-07-12
    • 1970-01-01
    • 1970-01-01
    • 2015-12-16
    • 1970-01-01
    相关资源
    最近更新 更多