1 //2 //VIEWCONTROLLER.M3 //catransition4 //5 //Created by Ys on 15/11/22.6 //Copyright (c) 2015 Ys. All rights reserved.7 //8 9 #import "ViewController.h"Ten One @interfaceViewcontroller () A@property (Weak, nonatomic) Iboutlet Uiimageview *ImageView; --(ibaction) Nextclick; --(ibaction) Previousclick; the@property (nonatomic,assign)intindex; - @end - - @implementationViewcontroller + -- (void) Viewdidload { + [Super Viewdidload]; A } at - --(ibaction) Nextclick { -self.index++; - if(Self.index = =9) { -Self.index =0; in } -NSString *imagename = [NSString stringWithFormat:@"%d.jpg", self.index+1]; toSelf.imageView.image =[UIImage imagenamed:imagename]; + -Catransition *anim =[catransition animation]; theAnim.type =@"Pagecurl"; *Anim.duration =0.5; $ [Self.imageView.layer Addanimation:anim forkey:nil];Panax Notoginseng } - the-(ibaction) Previousclick { +self.index++; A if(Self.index = =0) { theSelf.index =8; + } -NSString *imagename = [NSString stringWithFormat:@"%d.jpg", self.index+1]; $Self.imageView.image =[UIImage imagenamed:imagename]; $ -Catransition *anim =[catransition animation]; -Anim.type =@"Pageuncurl"; theAnim.duration =0.5; - [Self.imageView.layer Addanimation:anim forkey:nil];Wuyi } the @end
Coreanimation Core Animation (iii) catansition