Several animation modes in iOS (iOS animations)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.