/** 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