#pragma Mark Core Animation
-(ibaction) buttonPressed1: (ID) Sender {NSLog (@"1"); UIButton*button = (UIButton *) sender; Nsinteger Tag=Button.tag; Catransition*animation =[catransition animation]; 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.view Exchangesubviewatindex:green Withsubviewatindex:blue]; [[Self.view layer] addanimation:animation forkey:@"Animation"]; }
#pragma mark UIView Animation
-(ibaction) BUTTONPRESSED2: (ID) Sender {NSLog (@"2"); UIButton*button = (UIButton *) sender; Nsinteger Tag=Button.tag; Cgcontextref Context=Uigraphicsgetcurrentcontext (); [UIView Beginanimations:nil Context:context]; [UIView Setanimationcurve:uiviewanimationcurveeaseinout]; [UIView setanimationduration:kduration]; Switch(tag) { Case the: [UIView setanimationtransition:uiviewanimationtransitioncurldown ForView:self.view Cache:yes]; Break; Case 106: [UIView setanimationtransition:uiviewanimationtransitioncurlup ForView:self.view Cache:yes]; Break; Case 107: [UIView setanimationtransition:uiviewanimationtransitionflipfromleft ForView:self.view Cache:yes]; Break; Case 108: [UIView setanimationtransition:uiviewanimationtransitionflipfromright ForView:self.view Cache:yes]; Break; default: Break; } Nsuinteger Green=[[Self.view subviews] indexOfObject:self.greenView]; Nsuinteger Blue=[[Self.view subviews] indexOfObject:self.blueView]; [Self.view Exchangesubviewatindex:green Withsubviewatindex:blue]; [UIView setanimationdelegate:self]; //call a method when the animation is complete//[UIView setanimationdidstopselector: @selector (animationfinished:)];[UIView commitanimations];}
iOS Common animations