我正在使用animationImages和animationRepeatCount =1制作动画;如何检测动画何时完成?
谢谢,Tee
发布于 2010-01-04 22:06:45
当UIImageView动画完成时,您不会收到通知。您应该使用NSObject的performSelector:withObject:afterDelay:方法来安排一些代码在时间结束后执行,但这并不完美。
发布于 2010-01-04 22:06:23
将setAnimationDidStopSelector:设置为在动画停止时执行操作的方法。
发布于 2013-12-10 22:35:52
这是一个很老的问题,但我现在需要解决这个问题,这对我来说很有效:
[CATransaction begin];
[CATransaction setCompletionBlock:^{
DLog(@"Animation did finish.");
}];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.window.bounds];
imageView.animationDuration = 0.3 * 4.0;
imageView.animationImages = @[[UIImage AHZImageNamed:@"Default2"],
[UIImage AHZImageNamed:@"Default3"],
[UIImage AHZImageNamed:@"Default4"],
[UIImage AHZImageNamed:@"Default5"]];
imageView.animationRepeatCount = 1;
[self.window addSubview:imageView];
[imageView startAnimating];
[CATransaction commit];https://stackoverflow.com/questions/1999698
复制相似问题