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