2010-01-04 5 views

Répondre

3

Vous n'obtenez pas de notification lorsque les animations UIImageView sont terminées. Vous devez utiliser la méthode performSelector: withObject: afterDelay: de NSObject pour planifier l'exécution de code après que le temps soit écoulé, mais ce ne sera pas parfait.

1

question ancienne, mais il me fallait une solution maintenant, cela fonctionne pour moi:

[CATransaction begin]; 
[CATransaction setCompletionBlock:^{ 
    DLog(@"Animation did finish."); 
}]; 

UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.bounds]; 
imageView.animationDuration = 0.3 * 4.0; 
imageView.animationImages = @[[UIImage AHZImageNamed:@"Default2"], 
           [UIImage AHZImageNamed:@"Default3"], 
           [UIImage AHZImageNamed:@"Default4"], 
           [UIImage AHZImageNamed:@"Default5"]]; 
imageView.animationRepeatCount = 1; 
[self.window addSubview:imageView]; 

[imageView startAnimating]; 

[CATransaction commit];