On Jan 13, 2009, at 1:03 PM, Sebastian Morsch wrote:

I am having the same problem with UIImageView, just in my case, it's not FPS performance but running out of memory. Using + imageWithContentsOfFile didn't seem to solve the problem. I had 20 full screen PNGs loaded at the same time to hand them over to the view via the animationImages property, which almost always results in a memory warning.

Understandably, because that's 20*(320*480*4) = almost 12MB, which is way too much.

Pretty much. Using the animatedImages property requires all the images be accessible by the graphics hardware. As you may be aware, the graphics hardware can only view 24MB at a time (which includes the screen buffer and the back buffers of all of your views). If you go over 24MB then you fall off a performance cliff, as the driver has to juggle which memory is visible to the graphics hardware. This memory usage also competes with all other allocations that your application does, and any large allocation has a good chance to trigger a memory warning.

So my question is, how such an animation can be implemented? My next idea would be to do the animation myself by loading the next image, swapping it for the old one and dispose of the old one, so there's always just two images in memory at the same time. But I'm not sure, if this path is a good one because the timing of that process might be difficult to handle.

As you mention the timing is difficult to deal with. This would work fine for a slide show type animation where each image is onscreen for a fairly long length of time.

From my understanding, UIImageView can't be used for full frame animations with more than 10 images, or am I missing something? Is there another recommended strategy (besides using MPMoviePlayerController)?


This depends entirely on what you are attempting to implement. If you can do your animation programatically in some manner, then that would be the recommended course. Often people use OpenGL so that they can animate models with textures instead of pre-rendered content. Sometimes you can just use a set of static (or animated) but smaller images and move the hosting views around the screen. But exactly how you do it will depend on what you are trying to accomplish.
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to