A summary of the animation effects of using Uiimageview to display a bunch of pictures:
1. Create a container for this bunch of pictures, using Nsarray
Nsmutablearray *images = [Nsmutablearray array];
2 Use the Nsbudle class to load in the picture, and then each time a picture is loaded into a UIImage object, (Note: Using this class to load a picture can clear the cache, but other methods load such as
UIImage *image = [UIImage imagenamed:filename]; Method cannot clear the cache when it is loaded. )
NSString *filename = [NSString stringwithformat:@ "%@_%02d.jpg", name, i];// UIImage *image = [UIImage imagenamed: filename];// [Images addobject:image]; NSBundle *bundle = [NSBundle mainbundle]; NSString *path = [bundle Pathforresource:filename Oftype:nil]; UIImage *image = [UIImage Imagewithcontentsoffile:path];
3 put each UIImage object in the collection array.
[Images Addobject:image];
4. Assign the container array to the Animationimages property of the Uiimageview
Self.tom.animationImages = images;
5. Set the properties of the animation and start the animation
Self.tom.animationRepeatCount = 1; Self.tom.animationDuration = Images.count * 0.08; [Self.tom startanimating];
6 "Because every time the animation to pull the picture to load near memory, if not clear memory of useless image memory will be very high. So the way to clear the memory is
Clear picture Cache CGFloat delay = self.tom.animationDuration + 0.05; [Self.tom performselector: @selector (setanimationimages:) Withobject:nil Afterdelay:delay];
"iOS development" about displaying a series of pictures composing animation effect Uiimageview use