Pergunta

I have managed to make the "view" move once. I need for it to stay 1 second in same place and then move back again to initial place. How would I add the rest of the code for this? (This won't be a loop, only done once)

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

Solução

Use the completion block to do another animation:

[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];
}];
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top