UIImageView with hundreds of fullscreen images
I have a problem. I have a UIImageView and 144 fullscreen images (960x640). And I have a Timer that loads 15 images per second into the UIImageView. In the end the images are played like a movie. Everything works fine, but I get on an iphone4 memory warnings. I just have an Array which holds the filepaths to the images. The image that needs to be displayed is loaded with initWithContentsOfFile.
In my opinion I've done the best by using UIImageView. But as I said i get memory warnings and even on iphone4 it seems a bit slow.
I guess a better approach is using cocos2d/openGL or Core Animati开发者_Python百科on. But I dont know where to start. It's has to be fast (good perfomance) and memory foot print should be small as possible.
Hope somebody can point me in the right direction.
Thx in advance
You might want to peek here: best way to load an image library of iphone nsmutablearray (600+ items)
I ran some tests a while ago to accomplish something that sounds similar to what you're doing.
Will this help?
http://appsamuck.com/day2.html
// create the view that will execute our animation
UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
// load all the frames of our animation
campFireView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"campFire01.gif"],
[UIImage imageNamed:@"campFire02.gif"],
[UIImage imageNamed:@"campFire03.gif"],
[UIImage imageNamed:@"campFire04.gif"],
[UIImage imageNamed:@"campFire05.gif"],
[UIImage imageNamed:@"campFire06.gif"],
[UIImage imageNamed:@"campFire07.gif"],
[UIImage imageNamed:@"campFire08.gif"],
[UIImage imageNamed:@"campFire09.gif"],
[UIImage imageNamed:@"campFire10.gif"],
[UIImage imageNamed:@"campFire11.gif"],
[UIImage imageNamed:@"campFire12.gif"],
[UIImage imageNamed:@"campFire13.gif"],
[UIImage imageNamed:@"campFire14.gif"],
[UIImage imageNamed:@"campFire15.gif"],
[UIImage imageNamed:@"campFire16.gif"],
[UIImage imageNamed:@"campFire17.gif"], nil];
// all frames will execute in 1.75 seconds
campFireView.animationDuration = 1.75;
// repeat the annimation forever
campFireView.animationRepeatCount = 0;
// start animating
[campFireView startAnimating];
// add the animation view to the main window
[self.view addSubview:campFireView];
精彩评论