关于使用UIImageView显示一串图片组成动画效果的总结:
1》创建装这一串图片的容器,使用NSArray
NSMutableArray *images = [NSMutableArray array];
2》使用NSBudle类载入进来图片,然后每次载入进来一个图片就赋给一个UIImage对象,(注意:使用这个类载入进来的图片能够清除缓存,可是其它方法载入比方
UIImage *image = [UIImage imageNamed:fileName];方法载入的无法清除缓存。
)
NSString *fileName = [NSString stringWithFormat:@"%@_%02d.jpg",name, i]; // UIImage *image = [UIImage imageNamed:fileName]; // [images addObject:image]; NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle pathForResource:fileName ofType:nil]; UIImage *image = [UIImage imageWithContentsOfFile:path];3》把每个UIImage对象放入集合数组中。
[images addObject:image];
self.tom.animationImages = images;
self.tom.animationRepeatCount = 1; self.tom.animationDuration = images.count * 0.08; [self.tom startAnimating];
//清除图片缓存 CGFloat delay = self.tom.animationDuration + 0.05; [self.tom performSelector:@selector(setAnimationImages:) withObject:nil afterDelay:delay];
【iOS开发】关于显示一连串图片组成动画效果UIImageView的使用
原文:http://www.cnblogs.com/hrhguanli/p/5106197.html