iOS Development Core Animation Seven: The difference between core animation and UIView animation

Source: Internet
Author: User

/** What is the difference between UIView and core animation?    Master   1. The core animation only works on layer.    2. The core animation sees the false image, it does not go to modify the real position of the uiview.   When do I use the core animation?   1. When you do not need to interact with the user, use the Core animation 2. When you want to animate according to the path, use the core animation: Cabasicanimation,cakeyframeanimation, two can draw the path according to the drawn path Uibizerpath to perform the animation 3. Use the core animation (more than the core animation transition type) as a transition animation catrasition or UIView core animation*/#import "ViewController.h"@interfaceViewcontroller () @property (weak, nonatomic) Iboutlet UIView*Redview;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; NSLog (@"%@", Nsstringfromcgrect (self.redView.frame)); }-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event {    //cabasicanimation *anim = [cabasicanimation animation];//Anim.keypath = @ "POSITION.Y";//anim.tovalue = @400;//anim.removedoncompletion = NO;//anim.duration = 1;//anim.fillmode = kcafillmodeforwards;//anim.delegate = self;//[Self.redView.layer Addanimation:anim forkey:nil];[UIView animatewithduration:0.5animations:^{Self.redView.center= Cgpointmake ( -, -); }completion:^(BOOL finished) {NSLog (@"%@", Nsstringfromcgrect (self.redView.frame));        }]; }//execution at start of animation-(void) Animationdidstart: (Caanimation *) Anim {//NSLog (@ "%s", __func__);}//Execute when animation is complete-(void) Animationdidstop: (Caanimation *) Anim finished: (BOOL) Flag {//NSLog (@ "%s", __func__); //NSLog (@ "finished==%@", Nsstringfromcgrect (Self.redView.frame));}@end

1.UIView and core animation differences?

Core animations can only be added to Calayer

Core animations everything is an illusion and does not change the true value.

2. When do I use UIView animations?

Use UIView animations If you need to interact with the user.

No need to interact with the user can use the core animation

3. What scenes use the most core animations?

In transition animations, the type of core animation is more

Animate according to a path, only with the core animation (frame animation)

Animation group: Make multiple animations at the same time

iOS Development Core Animation Seven: The difference between core animation and UIView animation

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.