我想在特定的时间内制作动画。我的代码如下:
- (void)animate{
NSArray *myImages = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:@"01.png"],
[UIImage imageNamed:@"02.png"],
[UIImage imageNamed:@"03.png"],
[UIImage imageNamed:@"04.png"],
[UIImage imageNamed:@"05.png"],
[UIImage imageNamed:@"06.png"],
[UIImage imageNamed:@"07.png"],
[UIImage imageNamed:@"08.png"],
[UIImage imageNamed:@"09.png"],
[UIImage imageNamed:@"10.png"],
[UIImage imageNamed:@"11.png"],
[UIImage imageNamed:@"12.png"],
[UIImage imageNamed:@"13.png"],
nil];
faceImage.animationImages = myImages;
faceImage.animationDuration = 4.0;
faceImage.animationRepeatCount = 4;
[faceImage startAnimating];
}
现在的问题是经过动画持续时间后,animationRepeatCount 会再持续几秒钟!但我想在那 4 秒内制作我的动画重复计数。4 秒后我的动画应该停止了!我在做我的代码有什么问题?或者,我该如何解决这个问题?