首页 > 移动平台 > 详细

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

时间:2015-09-06 19:47:35      阅读:248      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!