Swift - tableview cell 从底部到顶部动画
func animateTable() {
masterTableView.reloadData()
let cells = masterTableView.visibleCells
let tableHeight = masterTableView.bounds.size.height
// move all cells to the bottom of the screen
for cell in cells {
cell.transform = CGAffineTransform(translationX: 0, y: tableHeight)
}
// move all cells from bottom to the right place
var index = 0
for cell in cells {
UIView.animate(withDuration: duration, delay: 0.05 * Double(index), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
cell.transform = CGAffineTransform(translationX: 0, y: 0)
}, completion: nil)
index += 1
}
}
本文标题:Swift - tableview cell 从底部到顶部动画
本文链接:https://www.haomeiwen.com/subject/nwjlwttx.html
网友评论