UIImageView and swapping images02 Dec
Out of curiosity, related to a real need, I decided to see what I could do to animate a series of images within a UIImage view; the built-in animationImages wouldn’t work for my need. Of course, I wanted to push things a little bit, just to see where the boundaries lay.
So, for the test I ran through 5000 images (320×480 jpg) and “swapped” one after another into a UIImageView ([anImageView setImage:...]), for a single loop. The results may be of benefit for someone else, so if you’re that person, here you go:
In order of efficiency/speed:
[UIImage imageWithData:...] // 44.8 seconds
[UIImage imageWithContentsOfFile:...] // 52.3 seconds
[[UIImage alloc] initWithContentsOfFile:…] // 351.8 seconds
[UIImage imageNamed:...] // hung
I may dive further in and experiment with Quartz to see if there are any additional (and worthwhile) gains to be had…but that’s for another day.
Leave a Reply