码迷,mamicode.com
首页 > 移动开发 > 详细

IOS第18天(8,核心动画转场动画)

时间:2015-09-06 19:48:22      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

***翻页效果

#import "HMViewController.h"

@interface HMViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (nonatomic, assign) int index;

@end

@implementation HMViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    _index = 1;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    _index++;
    
    if (_index == 4) {
        _index = 1;
    }
    NSString *fileName = [NSString stringWithFormat:@"%d",_index];
    _imageView.image = [UIImage imageNamed:fileName];
    
    CATransition *anim = [CATransition animation];
    
    anim.type = @"pageCurl";
    
    anim.subtype = kCATransitionFromLeft;
//    anim.startProgress = 0.5;
    
    anim.duration = 2;
    
    [_imageView.layer addAnimation:anim forKey:nil];
}

@end

 

IOS第18天(8,核心动画转场动画)

标签:

原文地址:http://www.cnblogs.com/ios-g/p/4786729.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!