iOS Development-Core animation essays

Source: Internet
Author: User

  • Core Animations
    Allows the view to rotate, scale, and pan (primarily the layer property of the view) but the location of the core animation is not the real position, and everything is false. So sometimes you need to use other animations, like UIView originally encapsulated animations, and timers
    // achieve 360° rotation of pictures cabasicanimation* rotationanimation;   = [Cabasicanimation Animationwithkeypath:@ "transform.rotation.z"];   2.0  ];   = duration;   = YES;   = repeat;  [View.layer addanimation:rotationanimation Forkey: @" rotationanimation "];

  • timer

    Cadisplaylink calls 60 times per second

     / /  create timer  cadisplaylink *link = [ Cadisplaylink displaylinkwithtarget:self selector: @selector (XXX)];  //  Join the run loop  [link addtorunloop: [Nsrunloop Mainrunloop] formode:nsdefaultrunloopmode];  //  Implement the XXX method -(void  ) xxx{ //  Animation method  }  

    * * * When using the button click (or other events) to enable the timer, to lazy load timer, or continuous click on the button, the timer will accumulate.

    Timer has a stopped property

    Link.pause = NO;//Timer end

    Link.pause = YES;//Timer stop

    • There are two methods of loading Xib
      // 1. This should be used when there is no connection with storyboard -(ID) Initwithcoder: (Nscoder *) adecoder{}//2. This is used with the storyboard connection -(void) awakefromnib{} Otherwise, the properties in the view class cannot be taken

    • Crop a picture
      // a piece of footage with multiple images to trim, then use the core animation for UI layout // To trim the image method, the first parameter passes the image.cgimage to be clipped, the second parameter passes the dimension here to see if the picture is a pixel. Cgimagecreatwithiamgeinrect (,);



iOS Development-Core animation essays

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.