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.

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.

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)?

Thanks,
Sebastian



Am 13.01.2009 um 19:24 schrieb David Duncan:

On Jan 12, 2009, at 8:10 PM, Glenn Bloom wrote:

- When I animate a set of PNG's rather than JPEG's (again using
UIImageView's animationImages property), I am thinking I don't need to think about compression (or Apple optimization)? Is it then appropriate to think of the total memory to be consumed simply as an aggregate of the total
bytes for all the images?

Basically yes. The rule of thumb is Width * Height * 4 for each image. Images must be decompressed before display. The PNG optimization that Xcode applies converts the image to a format that is optimal for display, it doesn't reduce the amount of storage needed to display it.

- Am I correct in thinking that for loading a short-running animation, I should generally use the initWithContentsOfFile method of UIImage instead of
imageNamed because imageNamed caches the data into memory?

Unless you can prove that you get better performance with +imageNamed: you should always prefer +imageWithContentsOfFile: or - initWithContentsOfFile:. This is especially true with large images (primarily because they consume lots of memory and are not reused often enough to gain a benefit).

- I had thought there was a way to use Instruments to assess if a
UIImageView animation was skipping frames. Now, I'm not so sure. Any particular way to test if such an animation is skipping or not displaying
frames?


You can get an FPS meter from the Core Animation instrument. This may or may not be what you are thinking of.
--
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/sebastianmorsch%40mac.com

This email sent to sebastianmor...@mac.com

_______________________________________________

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