iOS Common animations

Source: Internet
Author: User

#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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.