Basically, I have a UITableView
where that I want to animate when a button is tapped. Every cell should be scaled by 1.10 and return to their transform identity. So that's two different animations for each cell that I doing with UIView.animateKeyframesWithDuration
.
But I want to have them slightly delayed from each other. So I call this method in a loop like this:
for (index, cell) in tableView.visibleCells.enumerate() {
let delay = 0.1 * Double(index)
let duration = 0.5
UIView.animateKeyframesWithDuration(duration, delay: delay, options: [], animations: {
UIView.addKeyframeWithRelativeStartTime(0.0, relativeDuration: duration * 1/2, animations: {
cell.transform = CGAffineTransformScale(cell.transform, 1.10, 1.10)
})
UIView.addKeyframeWithRelativeStartTime(1/2, relativeDuration: duration * 1/2, animations: {
cell.transform = CGAffineTransformIdentity
})
}, completion: nil)
}
The problem is that the completion part works only for each animation.
What I'm looking for is a way to do something once every animation is completed. How can I achieve that?
didSet {}
but I was wondering if there was a proper way to do it. - Nico