标签:
关于使用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://blog.csdn.net/ttf1993/article/details/44307003