首页 > 代码库 > 核心动画-翻页效果的实现

核心动画-翻页效果的实现

1、先导入

#import <QuartzCore/QuartzCore.h>框架,并在工程中导入该框架

2、

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {    self.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%i.jpg", _imageIndex]];    _imageIndex++;    if (_imageIndex > 9) {        _imageIndex = 1;    }        CATransition *anim = [CATransition animation];    // 动画类型    anim.type = @"pageCurl";    // 过渡方向    anim.subtype = kCATransitionFromRight;// 动画延迟    anim.duration = 0.5;// 添加动画    [self.view.layer addAnimation:anim forKey:nil];}

 

核心动画-翻页效果的实现