Normal animations for iOS can be animated using the Uikit provided;
Complex animations can use the core Animation.
1. Using Uikit animations through animation contexts
-(void) animationofuikit { uiview *redview=[[uiview Alloc]initwithframe:cgrectmake (10, 10, 100, 100)]; [self.view addsubview:redview]; //Start Animation [uiview beginanimations:@ "Test" context:nil]; //Animation Duration [UIView setAnimationDuration:1]; //set the animation fade [uiview setanimationcurve: uiviewanimationcurveeaseinout]; /* * Where to animate settings */ Redview.backgroundcolor=[uicolor bluecolor]; redview.frame=cgrectmake ( 50, 50, 200, 200); redview.alpha=0.5; //Animation End [uiview commitanimations]; }
2. Using Uikit animations through code blocks
-(void) animationofblock { //Initializes a view to display the animation uiview *redview=[[uiview alloc]initwithframe:cgrectmake (10, 10, 100,  100)]; [self.view addsubview:redview]; [uiview animatewithduration:1 //length delay:0 //Delay Time options: uiviewanimationoptiontransitionflipfromleft//animation effects animations:^{ // Animate Settings Area      &NBsp; redView.backgroundColor=[UIColor blueColor]; redview.frame=cgrectmake (50, 50, 200, 200); redView.alpha=0.5; } completion:^ (BOOL finish) { //call at end of animation }];}
3, UIView, flip, rotate, offset, flip, zoom, reverse animation effect
The Cgaffinetransform class in the Coregraphics framework can be used to set the transform properties of the UIView, control the zoom of the view, rotate and pan, and so on (also known as the Radial Transformation matrix). This animation is for the starting reference for the center point of the original position of the view, and can be restored at the end of the operation:
view.transform=cgaffinetransformidentity;
Flipped animations
Start animation [UIView beginanimations:@ "Doflip" context:nil]; Settings are often [UIView setanimationduration:1]; Set animation fade [UIView setanimationcurve:uiviewanimationcurveeaseinout]; Set agent [UIView setanimationdelegate:self]; Set the rollover direction [UIView setanimationtransition:uiviewanimationtransitionflipfromleft Forview:manimageview Cache:YES]; End of animation [UIView commitanimations];
Rotate animation
Create a Cgaffinetransform Transform object Cgaffinetransform transform; Set Rotation degree transform = cgaffinetransformrotate (manimageview.transform,m_pi/6.0); Animation starts [UIView beginanimations:@ "rotate" context:nil]; Animation is often [UIView setanimationduration:2]; Add agent [UIView setanimationdelegate:self]; Gets the value of the transform [Manimageview settransform:transform]; Close animation [UIView commitanimations];
Offset animation
[UIView beginanimations:@ "move" context:nil]; [UIView Setanimationduration:2]; [UIView setanimationdelegate:self];//changes the value of x, y of its frame manimageview.frame=cgrectmake (100,100, 120,100); [UIView commitanimations];
Page flipping animation
[UIView beginanimations:@ "Curlup" context:nil]; Specifies the animation curve type, which is the default, linear is constant speed [UIView setanimationcurve:uiviewanimationcurveeaseinout];//animation is always set [UIView Setanimationduration:1]; [UIView setanimationdelegate:self]; Set the direction of page flipping [UIView setanimationtransition:uiviewanimationtransitioncurlup Forview:manimageview Cache:yes]; Close animation [UIView commitanimations];
Zoom Animation
Cgaffinetransform transform = Cgaffinetransformscale (manimageview.transform,1.2,1.2); [UIView beginanimations:@ "scale" context:nil]; [UIView Setanimationduration:2]; [UIView setanimationdelegate:self]; [Manimageview Settransform:transform]; [UIView commitanimations];
The inverse animation effect is to take his opposite animation according to the current animation
Cgaffinetransform transform = Cgaffinetransforminvert (Manimageview.transform); [UIView beginanimations:@ "Invert" context:nil]; [UIView setanimationduration:2];//animation is often [UIView setanimationdelegate:self]; [Manimageview settransform:transform];//gets the changed view of the transform [UIView commitanimations];//off animation
This article is from the "Sheep" blog, please make sure to keep this source http://5934497.blog.51cto.com/5924497/1703420
iOS learning animation one of Uikit animations