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

tableViewCell创建时添加一些动画

时间:2016-08-17 15:27:43      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

有时候因为项目的需要,给tableView添加一些动画:

cell.layer.transform = CATransform3DMakeScale(0.1, 0.1, 1);

       [UIView animateWithDuration:0.25 animations:^{

             cell.layer.transform = CATransform3DMakeScale(1, 1, 1);

        }];

或者 

- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath{

     if (indexPath.row % 2 != 0) {

        cell.transform = CGAffineTransformTranslate(cell.transform, ScreenWidth/2, 0);

    }else{

        cell.transform = CGAffineTransformTranslate(cell.transform, -ScreenWidth/2, 0);

    }

    cell.alpha = 0.0;

    [UIView animateWithDuration:0.7 animations:^{

        cell.transform = CGAffineTransformIdentity;

        cell.alpha = 1.0;

    } completion:^(BOOL finished) {

    }];

}

tableViewCell创建时添加一些动画

标签:

原文地址:http://www.cnblogs.com/WJJ-Dream/p/5780101.html

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