Cat Share, must boutique
Original articles, welcome reprint. Reprint Please specify: Sanayu's Blog
Address: http://blog.csdn.net/u013357243?viewmode=contents
SOURCE Material Address: http://download.csdn.net/detail/u013357243/8677065
Effect:
Code:
#import "NYViewController.h" @interface nyviewcontroller ()@property(Weak,nonatomic)Iboutlet Uiimageview*iconview;-(ibaction) Nextbtnclick: (ID) sender;-(ibaction) Prebtnclick: (ID) sender;@property(nonatomic,Assign)intIndex@end @implementation nyviewcontroller //Next- (ibaction) Nextbtnclick: (ID) Sender { Self. Index++;if( Self. Index>7) { Self. Index=1; }NSString*imagename = [NSStringstringwithformat:@"%d.jpg", Self. Index];UIImage*newimage = [UIImageImagenamed:imagename]; Self. IconView. Image= NewImage;//1. Create a core animationCatransition *ca = [catransition animation];//1.1 animation transition TypeCa. Type= @"Cube";//1.2 animation transition DirectionCa. Subtype= Kcatransitionfromright;//1.3 Start of Animation (percentage in overall animation) //ca.startprogress = 0.5; //1.3 Animation End Point (percentage of overall animation) //ca.endprogress = 0.5; //Animation timeCa. Duration=1;//2. Add Core animations[ Self. IconView. LayerADDANIMATION:CA Forkey:Nil];}//Previous- (ibaction) Prebtnclick: (ID) Sender { Self. Index--;if( Self. Index<1) { Self. Index=7; }NSString*imagename = [NSStringstringwithformat:@"%d.jpg", Self. Index];UIImage*newimage = [UIImageImagenamed:imagename]; Self. IconView. Image= NewImage;//1. Create a core animationCatransition *ca = [catransition animation];//1.1 Tell the system what animations to performCa. Type= @"Cube"; Ca. Subtype= Kcatransitionfromleft; Ca. Duration=1;//2. Add Core animations[ Self. IconView. LayerADDANIMATION:CA Forkey:Nil];}@end
(material source) Cat learn iOS (41) UI core animation two lines of code to fix 3D transitions (do Android crying)