iOS Cell小动画

这里让后出现的Cell有一个小动画,稍微延迟一点出现,如下图:

iOS Cell小动画_第1张图片

代码的实现非常简单

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    cell.transform = CGAffineTransform(translationX: 0, y: 30)
    UIView.animate(withDuration: 0.8) {
        cell.transform = .identity
    }
}

你可能感兴趣的:(iOS Cell小动画)