码迷,mamicode.com
首页 > 其他好文 > 详细

Core Animation 学习笔记(一)

时间:2014-08-27 18:48:38      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:color   io   for   cti   on   size   ad   ef   c   

看到网易贴吧的点赞的动画,模仿做了个差不多的效果
-(void)zanAction
{
    UILabel *oneLbl =[[UILabel alloc]init];
    oneLbl.frame = CGRectMake(_zanBtn.frame.origin.x, _zanBtn.frame.origin.y, 35, 20);
    oneLbl.text =@"+1";
    oneLbl.font = [UIFont boldSystemFontOfSize:17.0];
    oneLbl.textColor = [UIColor colorWithRed:236/255.0 green:93/255.0 blue:114/255.0 alpha:0.8];
    
    CGRect rect =_zanBtn.frame;
    [_zanBtn setImage:[UIImage imageNamed:@"praised.png"] forState:UIControlStateNormal];
    
    [UIView animateWithDuration:0.2+3
                          delay:0
                        options:0 animations:^{
                            _zanBtn.frame = CGRectMake(_zanBtn.frame.origin.x, _zanBtn.frame.origin.y, _zanBtn.frame.size.width*1.2, _zanBtn.frame.size.height*1.2);
                            
                        } completion:^(BOOL finished){
                            _zanBtn.frame =rect;
                            [UIView animateWithDuration:0.8+3
                                                  delay:0
                                                options:0 animations:^{
                                                    [self.view addSubview:oneLbl];
                                                    //上、右移动10px  增大到1.2倍
                                                    oneLbl.frame = CGRectMake(oneLbl.frame.origin.x , oneLbl.frame.origin.y-25, oneLbl.frame.size.width*1.4, oneLbl.frame.size.height*1.4);
                                                    oneLbl.alpha = 0;
                                                } completion:^(BOOL finished){
                                                    [oneLbl removeFromSuperview];
                                                    
                                                }];
                             }] ;
                            
}

Core Animation 学习笔记(一)

标签:color   io   for   cti   on   size   ad   ef   c   

原文地址:http://blog.csdn.net/xiaoyuertongxue/article/details/38873419

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