我有一组序列帧,想用UIImageView来做成动画。我的代码如下
UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
NSMutableArray *moviesSourceArray = [NSMutableArray arrayWithCapacity:200];
int i = 1;
for (i = 1; i <= 100; i++) {
NSString *imageName;
imageName = [NSString stringWithFormat:@"image%i.png",i];
[moviesSourceArray addObject:[UIImage imageNamed:imageName]];
}
campFireView.animationImages = moviesSourceArray;
campFireView.animationDuration = 1.75;
campFireView.animationRepeatCount = 0;
[campFireView startAnimating];
[controller.view addSubview:campFireView];
[campFireView release];
我的序列帧图片比较多,一共40M的样子,200张。如果全部图片都加入进来播放的话就会崩溃,减少到100张能正常运行。有没有其他比较好的办法或者优化方案来实现播放完整动画而又不会出现这样内存占用太多崩溃的情况呢?