2010-08-03 3 views
0

J'ai ce code mais il joue une animation sur une boucle et je veux seulement qu'elle joue une fois.Cocoa Touch - Jouer une animation une fois

Une aide?

-(void)gameOver{ //blow up ship 

    //animate explostion 
    UIImage *firstBoom = [UIImage imageNamed:@"Explo_0.png"]; 
    UIImageView *bigBoom = [[UIImageView alloc] initWithImage:firstBoom]; 
    bigBoom.animationImages = [NSArray arrayWithObjects: 
           [UIImage imageNamed:@"Explo_1.png"], 
           [UIImage imageNamed:@"Explo_1.png"], 
           [UIImage imageNamed:@"Explo_1.png"], 
           [UIImage imageNamed:@"Explo_2.png"], 
           [UIImage imageNamed:@"Explo_2.png"], 
           [UIImage imageNamed:@"Explo_2.png"], 
           [UIImage imageNamed:@"Explo_3.png"], 
           [UIImage imageNamed:@"Explo_3.png"], 
           [UIImage imageNamed:@"Explo_3.png"], 
           [UIImage imageNamed:@"Explo_4.png"], 
           [UIImage imageNamed:@"Explo_4.png"], 
           [UIImage imageNamed:@"Explo_4.png"], 
           [UIImage imageNamed:@"Explo_4.png"], 
           [UIImage imageNamed:@"Explo_4.png"], 
           nil]; 
    bigBoom.center = CGPointMake(xCoordinate, yCoordinate); //so it explodes ontop of the ship 

    [bigBoom startAnimating]; 
    [self.view addSubview:bigBoom]; 
    [shipImageView setHidden:YES]; 
} 

Répondre

4

Ajouter la ligne:

bigBoom.animationRepeatCount = 1; 
+0

fonctionne très bien assez trop facile. Je vais accepter cette réponse plus tard, je dois attendre. – user377419