Animation 使用数组设置图像动画

Animation 使用数组设置图像动画,animation,uiimage,Animation,Uiimage,我正在使用这样的数组设置一些图像的动画 NSArray *weatherFrames = [NSArray array]; weatherFrames = [[NSArray alloc] initWithObjects: [UIImage imageWithData:Data1], [UIImage imageWithData:Data2], [UIImage imageWithData:Data3],

我正在使用这样的数组设置一些图像的动画

NSArray *weatherFrames = [NSArray array];
weatherFrames = [[NSArray alloc] initWithObjects:
             [UIImage imageWithData:Data1],
             [UIImage imageWithData:Data2],
             [UIImage imageWithData:Data3],
             [UIImage imageWithData:Data4],
             [UIImage imageWithData:Data5],                 
             nil];
weatherImage.animationImages = weatherFrames;
weatherImage.animationDuration = 10.00;
weatherImage.animationRepeatCount = 1;
[weatherImage release];  
我想做的是在有人触发呼叫时暂停动画,例如从IBAction。这是可能的还是有更好的方法


谢谢

我从答案中复制了答案

要让CALayer传递给pauseLayer函数,可以使用以下代码

CALayer *player = ImageView.layer;
[self pauseLayer:player];
CALayer *player = ImageView.layer;
[self pauseLayer:player];