swift 最近在学一些小动画

给cell加上3D效果


func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        cell.layer.transform = CATransform3DMakeScale(0.1, 0.1, 1)
        UIView.animate(withDuration: 1) { 
            cell.layer.transform = CATransform3DMakeScale(1, 1, 1)
        }
    }

从底部升上来

cell.transform = CGAffineTransform(translationX: 0, y: self.IBTableView.bounds.height)
        UIView.animate(withDuration: 1.0, delay: 0.05 * Double(indexPath.row), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
            cell.transform = CGAffineTransform(translationX: 0, y: 0);
        }, completion: nil)

你可能感兴趣的:(swift 最近在学一些小动画)