让tableViewCell动画显示(swift)
func
animateTable() {
self . tableView . reloadData ()
let cells = tableView . visibleCells
let tableHeight: CGFloat = bounds . size . height
for i in cells {
let cell: UITableViewCell = i as UITableViewCell
cell. transform = CGAffineTransformMakeTranslation ( 0 ,tableHeight)
}
var index = 0
for a UITableViewCell = a UITableViewCell
UIView . animateWithDuration ( 1.5 ,delay: 0.05 * Double (index),usingSpringWithDamping: 0.8 ,initialSpringVelocity: 0 );
},completion: nil )
index += 1
}
self . tableView . reloadData ()
let cells = tableView . visibleCells
let tableHeight: CGFloat = bounds . size . height
for i in cells {
let cell: UITableViewCell = i as UITableViewCell
cell. transform = CGAffineTransformMakeTranslation ( 0 ,tableHeight)
}
var index = 0
for a UITableViewCell = a UITableViewCell
UIView . animateWithDuration ( 1.5 ,delay: 0.05 * Double (index),usingSpringWithDamping: 0.8 ,initialSpringVelocity: 0 );
},completion: nil )
index += 1
}
}
原文链接:https://www.f2er.com/swift/324648.html