Uiimageview 使用动画样式从阵列设置图像动画

Uiimageview 使用动画样式从阵列设置图像动画,uiimageview,uiviewanimation,Uiimageview,Uiviewanimation,我有3个图像在我的数组中,它只是没有任何风格的动画。我想像淡入淡出风格的动画 NSArray *imarray = [[NSArray alloc] initWithObjects: [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/lady1_open.png", path]], [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"

我有3个图像在我的数组中,它只是没有任何风格的动画。我想像淡入淡出风格的动画

NSArray *imarray =  [[NSArray alloc] initWithObjects:
  [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/lady1_open.png",  path]],
  [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/lady1_open2.png", path]],
  [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/lady1_open3.png", path]],
  nil];

bingo_girl.animationImages=imarray;
bingo_girl.animationDuration=5;
bingo_girl.animationRepeatCount=0;
[bingo_girl.layer addAnimation:transition forKey:nil];
[bingo_girl startAnimating];

例如,您可以使用此类别手动设置带有过渡的图像的动画

@implementation UIImageView (AnimateTransition)
 - (void) assignImage:(UIImage *)image withTransition:(NSString *)withTransition withDirection:(NSString *)withDirection{

if(image == nil)
{
    [self setImage:nil];
    return;
}

if ([UIImagePNGRepresentation(self.image) isEqualToData:UIImagePNGRepresentation(image)])        {
    return;
}

CATransition *animation = [CATransition animation];
animation.duration = 0.2;
animation.type = withDirection;
animation.subtype = withDirection;
[[self layer] addAnimation:animation forKey:@"imageFade"];
[self setImage:image];
}

@end

transition
从何而来?它是如何创建的,等等?此转换只是一帧一帧地更改,但与我想要的不同。-(void)assignImage:(UIImage*)image with transition:(NSString*)with transition with direction:(NSString*)with direction;似乎这个方法对数组不起作用。或者我做错了,它是一个图像的方法。只需使用计时器遍历图像,并应用此方法在UIImageView中更改图像