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

cell的动画效果,加载更多时候的波浪效果(既整个cell的波浪效果)

时间:2015-08-11 20:40:41      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:

1.波浪效果是在tableView 上的cell上实现的,在cell.m中写如下代码:

 

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    [super setSelected:selected animated:animated];    

    [self buttonAnimation];

}

 

2.动画方法:

- (CAAnimation *)animationRotate

 

{

    //    UIButton *theButton = sender;

    // rotate animation

    CATransform3D rotationTransform  = CATransform3DMakeScale(1, 1, 1);

    CATransform3D rotationTransform2 = CATransform3DMakeScale(1.1, 1.1, 1.1);

    CABasicAnimation* animation;

    animation = [CABasicAnimation animationWithKeyPath:@"transform"];

    animation.toValue        = [NSValue valueWithCATransform3D:rotationTransform2];

    animation.fromValue        = [NSValue valueWithCATransform3D:rotationTransform];

    animation.duration        = .5;

    animation.autoreverses    = YES;

    animation.cumulative    = YES;

    animation.repeatCount    = 1;

    animation.beginTime        = 0;

    animation.delegate        = self;

    return animation;

}

 

- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag

 

{

    //    [self buttonAnimation];

    

}

 

- (void)buttonAnimation{

    CAAnimation* myAnimationRotate = [self animationRotate];

    CAAnimationGroup *m_pGroupAnimation     = [CAAnimationGroup animation];

    m_pGroupAnimation.delegate              = self;

    m_pGroupAnimation.removedOnCompletion   = NO;

    m_pGroupAnimation.duration              = 1;

    m_pGroupAnimation.timingFunction        = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

    m_pGroupAnimation.repeatCount           = 0;//FLT_MAX;  //"forever";

    m_pGroupAnimation.fillMode              = kCAFillModeForwards;

    m_pGroupAnimation.animations             = [NSArray arrayWithObjects:myAnimationRotate,nil];

    [self.layer addAnimation:m_pGroupAnimation forKey:@"animationRotate"];

}

 

cell的动画效果,加载更多时候的波浪效果(既整个cell的波浪效果)

标签:

原文地址:http://www.cnblogs.com/dongfengrong/p/4721734.html

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