1. Create a mutable array--mutablearray, for storing, UIImage objects, pictures to animate
2. Execute a For loop
1. Stitching Picture Name
2. Instantiate a Picture object--UIImage
3. Adding a UIImage object to a mutable array
3. Assigning a variable array to the Uiimageview animationimages
Sets the picture of the last UIImage object in the array for ImageView
Set number of repetitions: Animationrepeatcount: If not set, the default is infinite loop
Set animation time: According to the number of pictures to decide
4. Turn on animations
[Animationimageview startaaimating];
Two ways to load pictures:
[UIImage imagenamed:imagestring]: cache is generated
Advantage: The next access speed back more quickly
Cons: Taking up memory space
by imagewithcontentsoffile: Loading pictures loading pictures Larger, consuming memory
Pros: No cache is generated
Cons: Slow speed
NSString *imagestring = [NSString stringwithformat:@ "%@%03d.png", name, I];
To read the file path, add the suffix of the file
NSString *path = [[NSBundle mainbundle] pathforresource:imagestring Oftype:nil];
UIImage *image = [UIImage Imagewithcontentsoffile:path];
The self call cleararraypoint parameter is nil after the delay duration time
[Self performselector: @selector (cleararraypoint) Withobject:nil afterdelay:duration];
/**
_animationimageview: After duration, execute Setanimationimages: This method, the parameter is nil
*/
[_animationimageview performselector: @selector (setanimationimages:) Withobject:nil afterdelay:duration];
Assets.xcassets: In packaging, this folder will be compressed, encrypted only through Imagenamed: Access
Footage picture, smaller than the picture
If put into bundle: imagenamed: And Imagewithcontentsoffile: All can be method
When using a picture, both JPG and PNG are prefixed with a suffix.
If you set the picture PNG by code without setting the suffix name, JPG needs to be set
Place a larger picture, welcome page
Ios-ui Base-uiimageview Frame animation