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

iOS pop动画之弹性动画的基本使用

时间:2015-04-28 11:01:19      阅读:324      评论:0      收藏:0      [点我收藏+]

标签:

- (void)viewDidLoad

{

    [super viewDidLoad];

    [self initButton];

}

 

- (void)initButton

{

    UIButton *button = [[UIButton alloc]init];

    button.backgroundColor = [UIColor purpleColor];

    button.bounds = CGRectMake(0, 0, 100, 50);

    button.center = self.view.center;

    button.layer.cornerRadius = 5.f;

    [button addTarget:self action:@selector(clickedBtn:) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:button];

    self.button = button;

}

 

- (void)clickedBtn:(UIButton *)button

{

    POPSpringAnimation *spring = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];

    spring.velocity = [NSValue valueWithCGSize:CGSizeMake(10.f, 10.f)];

    spring.toValue = [NSValue valueWithCGSize:CGSizeMake(1.f, 1.f)];

    spring.springBounciness = 18.f;

    [self.button.layer pop_addAnimation:spring forKey:nil];

}

iOS pop动画之弹性动画的基本使用

标签:

原文地址:http://www.cnblogs.com/oumygade/p/4462198.html

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