2010-01-04 70 views

回答

3

当UIImageView动画完成时,您不会收到通知。你应该使用NSObject的performSelector:withObject:afterDelay:方法来安排一些代码在时间完成后执行,但它不会是完美的。

1

很老的问题,但我需要一个修复现在,这个工作对我来说:

[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];