Reputation: 641
I have a tableview and its bottom cell is special. Every time the table reloads, I want the bottom cell to slide up and the upper part of the table seems to be pushed up.
How can I implement this animation? Thanks!
Upvotes: 0
Views: 236
Reputation: 946
You can tell the tableView
to scroll to a certain row with animation. If that cell is last, just call this after reload:
let scrollToIndexPath = IndexPath(row: numberOfRows - 1, section: 0)
tableView.scrollToRow(at: scrollToIndexPath, at: .bottom, animated: true)
.bottom
means you want to scroll to the bottom of the visible tableView
.
Upvotes: 1