我有这段代码,但它在循环播放动画,我只想播放一次。
任何帮助?
-(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];
}
答案 0 :(得分:4)
添加以下行:
bigBoom.animationRepeatCount = 1;