(material source) Cat learn iOS (41) UI core animation two lines of code to fix 3D transitions (do Android crying)

Source: Internet
Author: User

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)

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.