0

我想创建递归动画。这是我的代码:

- (void)startAnimation {
    [UIView animateWithDuration:5.0
                     animations:^{
                         NSLog(@"animation");
                     }
                     completion:^(BOOL finished) {
                         if(!canceled) {
                             NSLog(@"completed");
                             [self startAnimation];
                         }
                     }
     ];
}

-(void)viewDidAppear:(BOOL)animated{
     //somewhere in your app, possibly viewDidLoad or viewDidAppear.
     [self startAnimation];
}

ISSUE:动画完成同时显示。我的错误在哪里。请帮我。

4

1 回答 1

0

尝试这个

[UIView animateWithDuration:5.0
                 delay:3.0
                 animations:^{
                     NSLog(@"animation");
                 }
                 completion:^(BOOL finished) {
                     if(!canceled) {
                         NSLog(@"completed");
                         [self startAnimation];
                     }
                 }
 ];
于 2013-04-12T08:53:55.967 回答