There are two main ways to achieve beautiful animations in iOS
One is at the UIView level,
One is to use catransition for lower levels of control,
The first is that the Uiview,uiview method may be used in the lower layer is also the use of catransition encapsulation, it can only be used for some simple, common effects show, here write a common sample code for your reference.
[UIView beginanimations:@ "Curl" context:nil];//animation starts [UIView setanimationduration:0.75]; [UIView setanimationdelegate:self]; [UIView Setanimationtransition:uiviewanimationtransitioncurlup Forview:myview Cache:yes]; [MyView Removefromsuperview]; [UIView commitanimations];
The second approach is relatively complex, but if you have better control, use this method,
The basic use of the method can look at the following example:
Catransition *animation = [catransition animation]; [Animation setduration:1.25f]; [Animation settimingfunction:[camediatimingfunction Functionwithname:kcamediatimingfunctioneasein]; [Animation Settype:kcatransitionreveal]; [Animation Setsubtype:kcatransitionfrombottom]; [Self.view.layer addanimation:animation forkey:@ "Reveal"];
The combination of Settype and Setsubtype is used here, which uses a comparison insurance because his parameters are defined in the official API, and their parameter descriptions can be referenced as follows:
[Animation settype:@ "Suckeffect"];
Here the Suckeffect is the effect name, the effect can be used mainly:
Pagecurl up a page pageuncurl down a page rippleeffect drop effect suckeffect shrinkage effect, such as a piece of cloth was pumped cube effect oglflip up and down flip effect
Finally, we give a common code for your reference.
Curl the image up or down catransition *animation = [Catransition animation]; [animation setDuration:0 .35]; [animation settimingfunction:uiviewanimationcurveeaseinout]; if (!curled) { //animation.type = @ "Mapcurl"; Animation.type = @ "Pagecurl"; Animation.fillmode = kcafillmodeforwards; animation.endprogress = 0.99; } else { //animation.type = @ " Mapuncurl "; animation.type = @" Pageuncurl "; Animation.fillmode = Kcafillmodebackwards; Animation.startprogress = 0.01; } [animation Setremovedoncompletion:no]; [View exchangesubviewatindex:0 withsubviewatindex:1]; [view addanimation:animation ForKey "PageCurlAnimation"] ; //Disable user interaction where necessary if (!curled) { } else { } curled =!curled; Reprint Original http://www.cnblogs.com/lovewx/p/3912417.html