Cocoa Touch - сыграй анимацию один раз - PullRequest
0 голосов
/ 03 августа 2010

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

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

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

1 Ответ

4 голосов
/ 03 августа 2010

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

bigBoom.animationRepeatCount = 1;
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...