There are a lot of animations in iOS today, let's introduce the simplest of two: Kinsoku and frame animations
First, the so-called end-to-end animation, as the name implies, is the need to animate the beginning of the code to set the beginning of the animation, in need of the animation of the time the code ends the animation, this is a simple tail-and-gave animation, not much said, on the code:
// Start Animation [UIView beginanimations:nil context:nil]; // This adds the code that needs to be animated // End Animation [UIView commitanimations];
Two. Frame animation, I believe that the people do flash frame animation is quite familiar with, I believe we all remember the childhood saw the animation, those animation is a page by page of the pattern composition, and then quickly switch, in our visual sense on the formation of animation! Frame animation takes a lot of frames a frame of the picture.
@interfaceViewcontroller () @property (nonatomic,weak) Uiimageview*Imgview;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //imgview.animationimages = "Array of pictures required for frame animation"//set the number of animations to repeatSelf.imgView.animationRepeatCount =1; //Set Animation playback time (2 seconds)Self.imgView.animationDuration =2; //Start Animation[Self.imgview startanimating]; //However, this animation needs to occupy a lot of memory, so after the playback to clear the memory, but the time to empty the memory to add delay time, otherwise the animation has not been played has been releasedCGFloat delay = self.imgView.animationDuration +1.0; [Self performselector: @selector (ClearCache) Withobject:nil Afterdelay:delay]; }- (void) clearcache{self.imgView.animationImages=Nil;}
Several animation modes in iOS (iOS animations)