iOS layer层的转场动画

来源:互联网 发布:app开发编程工具哪个好 编辑:程序博客网 时间:2024/05/17 06:53

layer层的转场动画
直接上代码

- (void)viewDidLoad {    [super viewDidLoad];    self.imageView = [[UIImageView alloc]initWithFrame:self.view.bounds ];    self.imageView.image = [UIImage imageNamed:@"1"];    [self.view addSubview:self.imageView];    UIButton * btn  = [[UIButton alloc]initWithFrame:self.view.bounds];    [self.view addSubview:btn];    [btn addTarget:self action:@selector(btnFun) forControlEvents:UIControlEventTouchDown];    // Do any additional setup after loading the view, typically from a nib.}-(void)btnFun{    CATransition * ca = [CATransition animation];    ca.type = @"rippleEffect";    ca.duration = 1;    [self.view.layer addAnimation:ca forKey:@"ca"];    self.imageView.image = [UIImage imageNamed:@"2"];}
属性 说明 type 动画过渡类型 subtype 动画过度方向 有4种分别是 : fromLeft, fromRight, fromTop and fromBottom。不是所有的type都有subtype startProgress 动画起点(在整体动画的百分比),通常不用设置 endProgress 动画终点(在整体动画的百分比) ,通常不用设置 duration 动画执行时间

type属性值说明
这里写图片描述

0 0
原创粉丝点击