Je fais une animation en utilisant animationImages et animationRepeatCount = 1; Comment puis-je détecter quand l'animation est terminée?Cocoa animationImages terminer la détection
Merci, T
Je fais une animation en utilisant animationImages et animationRepeatCount = 1; Comment puis-je détecter quand l'animation est terminée?Cocoa animationImages terminer la détection
Merci, T
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.
Réglez le setAnimationDidStopSelector: à une méthode qui prend action lorsque l'animation se fige.
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];
je pense que c'est pas l'animation 'UIImageView' - mais la' animation UIView'. – muescha