2010-08-03 2 views
0

У меня есть этот код, но он воспроизводит анимацию в цикле, и я хочу, чтобы она играла один раз.Cocoa Touch - Воспроизведение анимации

Любая помощь?

-(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]; 
} 

ответ

4

Добавьте строку:

bigBoom.animationRepeatCount = 1; 
+0

большой довольно легко тоже работает. Я буду принимать этот ответ позже, я должен ждать. – user377419