In iPhone development, we often need to perform animation switching between different pages, which looks better. There are three basic animations:
1. uiview
Uiview provides five official animation effects for you:
Uiviewanimationtransitionnone does not use the animation rotate from left to right to flip pages. The opposite is uiviewanimationtransitioncurlup, and uiviewanimationtransitioncurldown.
Example:
[Uiview beginanimations: @ "animationid" context: Nil]; // start an animation block. The first parameter is the animation block identifier [uiview setanimationduration: 0.5f]; // set the animation duration [uiview setanimationcurve: uiviewanimationcurveeaseinout]; // set the curve of the animation attribute change in the animation block. This method must be used in the beginanimations method and commitanimations method, the default value is uiviewanimationcurveeaseinout. For details, see uiviewanimationcurve [uiview setanimationrepeatautoreverses: No]; // sets whether to automatically reverse the current animation effect. [uiview setanimationtransition: uiviewanimationtransitionflipfromleft forview: Self. view cache: Yes]; // sets the animated Effect of transition. The first parameter can be set to [self. view exchangesubviewatindex: 1 withsubviewatindex: 0]; // page flip [uiview commitanimations]; // submit an animation
In this way, we can make the uiview page jump between pages through animation.
2. catransiton
Catransiton provides four types of animation effects:
Nsstring * const kcatransitionfade; // gradually disappears
Nsstring * const kcatransitionmovein; // overwrite
Nsstring * const kcatransitionpush; // available
Nsstring * const kcatransitionreveal; // opposite to movein
Example:
Catransition * animation = [catransition animation]; // initialize the animation. duration = 0.5f; // the interval of the animation. timingfunction = uiviewanimationcurveeaseinout; animation. type = kcatransitionpush; // set the animation effects of the above four types. subtype = kcatransitionfromtop; // set the animation direction. There are four options: kcatransitionfromright, kcatransitionfromleft, kcatransitionfromtop, and kcatransitionfrombottom [self. view. layer addanimation: animation forkey: @ "animationid"];
3. Private Animation
The private animation is based on the uiview and sets the animation. type. You can provide the following options:
Cube: ImageCubeFlipped like a body
Suckeffect: scaled down, just like the animation used to delete a photo
Oglflip: up/down rotation. When the subtype is fromleft or fromright, it is the same as uiviewanimationtransitionflipfromleft and uiviewanimationtransitionflipfromright.
Rippleeffect: Water Wave Effect
Pagecurl: Same as uiviewanimationtransitioncurlup
Pageuncurl: Same as uiviewanimationtransitioncurldown
Camerairishollowopen: First Half of camerairis.
Camerairishollowclose: Second Half of camerairis
Append an animationSource codeFor your reference, we will introduce the animation effect here today. Thank you.
Attachment address: http://files.cnblogs.com/huangdongcheng/transition_ViewTransitions.zip