这里让后出现的Cell有一个小动画,稍微延迟一点出现,如下图:
![](https://img.haomeiwen.com/i2708793/4b10e181c78b643b.gif)
代码的实现非常简单
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
}
}
网友评论