我有一组序列帧,想用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张能正常运行。
慕容森
隔江千里
相关分类