문제

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];
도움이 되었습니까?

해결책

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];
}];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top