iOS-tableViewCell创建时添加一些动画


有时候因为项目的需要,给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) {

    }];

}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM