您的位置:首页 > 移动开发 > IOS开发

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

2015-09-06 17:30 387 查看
***翻页效果

#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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: