iOS Animate simple animation experience

Source: Internet
Author: User

/*

= = = Gesture =====

One

1, Uiswipegesturerecognizer instantiation of a gesture initwithtarget

2. Set gesture Slide direction

3. Self.view Add this gesture instance

4. Adding events

Two

Tap

UITapGestureRecognizer

. Numberoftouchesrequire Number of fingers

. Numberoftapsrequire Hits

[Requiregesturerecognizertofail:] event conflict execution which one

1  2Uiswipegesturerecognizer *leftswipe =[[Uiswipegesturerecognizer alloc]initwithtarget:self Action: @selector (Leftswipeaction)];3 [Leftswipe Setdirection:uiswipegesturerecognizerdirectionleft];4     //[Self.view addgesturerecognizer:leftswipe];5 [Self.imageviewdemao addgesturerecognizer:leftswipe];6 7UITapGestureRecognizer *tapgesture =[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (Tapaction)];8tapgesture.numberoftouchesrequired =1;9tapgesture.numberoftapsrequired =1;Ten [Self.imageviewdemao addgesturerecognizer:tapgesture]; One  A  -UITapGestureRecognizer *tapgesture2 =[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (TapAction2)]; -tapgesture2.numberoftouchesrequired =1; thetapgesture2.numberoftapsrequired =2; - [Self.imageviewdemao Addgesturerecognizer:tapgesture2]; -      -     //Uigesturerecognizer Resolving the event overlap process +[Tapgesture Requiregesturerecognizertofail:tapgesture2];

= = = Simple Animation (gesture event) = = =

---------One,

1. Animation starts

[UIView beginanimations:]

2. Animation settings

Setanimationduration time

Setanimationtransition

3. Animation submission

[UIView Commitanimations]

-------Second,

Catransition (differs from catransaction)

1. Instantiate an animation

2,. Type

. Subtype

3, [Self.view.layer Addanimation:forkey:]

*/

1Catransition *animation =[catransition animation];2Animation.type =@"Cube";3Animation.subtype =Kcatransitionfromright;4[Self.imageViewDemao.layer addanimation:animation Forkey:@" Left"];5SELF.I + +;6     if(Self.i >3)7     {8SELF.I =1;9     }Ten     //Self.view.backgroundColor = [Uicolor colorwithpatternimage:[uiimage imagenamed:[nsstring stringwithformat:@ "%d" , SELF.I]]; OneSelf.imageViewDemao.image = [UIImage imagenamed:[nsstring stringWithFormat:@"%d", SELF.I]]; A      -      -     /* theType - ade//Crossfade Transitions (transition direction not supported) - Push//New view roll out the old view - Movein//New view above the old view + reveal//move the old view away to show the new view below - cube//Cube Rollover effect-this works well + oglflip//Upper and lower left and right rollover effect A suckeffect//shrinkage effect, such as a piece of cloth is pumped away (not support transition direction) at rippleeffect//Drip effect (transition direction not supported) - Pagecurl//Page UP effect - pageuncurl//Page DOWN effect - Camerairishollowopen//Camera lens open effect (transition direction not supported) - camerairishollowclose//Camera lens Close effect (no transition direction is supported) -       in      */

iOS Animate simple animation experience

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.