#pragma Mark Core Animation
-(ibaction) buttonPressed1: (ID) Sender {
UIButton *button = (UIButton *) sender;
nsinteger tag = button. tag;
catransition *animation = [catransitionanimation];
Animation. delegate = self;
Animation. Duration = Kduration;
Animation. timingfunction = Uiviewanimationcurveeaseinout;
Switch (tag) {
Case 101:
Animation. type = Kcatransitionfade;
break;
Case 102:
Animation. type = Kcatransitionpush;
break;
Case 103:
Animation. type = kcatransitionreveal;
break;
Case 104:
Animation. type = Kcatransitionmovein;
break;
Case 201:
Animation. type = @ "Cube";
break;
Case 202:
Animation. type = @ "Suckeffect";
break;
Case 203:
Animation. type = @ "Oglflip";
break;
Case 204:
Animation. type = @ "Rippleeffect";
break;
Case 205:
Animation. type = @ "Pagecurl";
break;
Case 206:
Animation. type = @ "Pageuncurl";
break;
Case 207:
Animation. type = @ "Camerairishollowopen";
break;
Case 208:
Animation. type = @ "Camerairishollowclose";
break;
default:
break;
}
Switch (self.) TypeID) {
Case 0:
Animation. Subtype = kcatransitionfromleft;
break;
Case 1:
Animation. Subtype = Kcatransitionfrombottom;
break;
Case 2:
Animation. Subtype = kcatransitionfromright;
break;
Case 3:
Animation. Subtype = kcatransitionfromtop;
break;
default:
break;
}
Self. TypeID + = 1;
if (self.) TypeID > 3) {
Self. TypeID = 0;
}
nsuinteger green = [self. View subviews] indexofobject:self. Greenview];
Nsuinteger blue = [self. View subviews] indexofobject:self. Blueview];
[self. Viewexchangesubviewatindex: Green withsubviewatindex: blue];
[Self. View Layer] addanimation: Animation forkey:@ "animation"];
}
#pragma mark UIView animation
-(ibaction) ButtonPressed2: (ID) Sender {
UIButton *button = (UIButton *) sender;
nsinteger tag = button. tag;
cgcontextref context = uigraphicsgetcurrentcontext();
[UIViewbeginanimations:Nilcontext: context];
[UIViewsetanimationcurve:uiviewanimationcurveeaseinout];
[UIViewsetanimationduration:kduration];
Switch (tag) {
Case :
[UIViewsetanimationtransition:uiviewanimationtransitioncurldownforview: /c24>self. ViewCache:YES];
break;
Case 106:
[UIViewsetanimationtransition:uiviewanimationtransitioncurlupforview:S Elf. ViewCache:YES];
break;
Case 107:
[UIViewsetanimationtransition:uiviewanimationtransitionflipfromleftforview : self . ViewCache : YES ];
break;
Case 108:
[UIViewsetanimationtransition:uiviewanimationtransitionflipfromrightforview: self. ViewCache:YES];
break;
default:
break;
}
nsuinteger green = [self. View subviews] indexofobject:self. Greenview];
Nsuinteger blue = [self. View subviews] indexofobject:self. Blueview];
[self. Viewexchangesubviewatindex: Green withsubviewatindex: blue];
[UIViewsetanimationdelegate:self];
// After the animation is complete call a method
//[uiview setanimationdidstopselector: @selector (animationfinished:)];
[UIViewcommitanimations];
}