首页 > 移动平台 > 详细

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

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