I've a UITableView
and I'm trying to load 36 rows into it and then scroll all the way down the last cell.
I've tried this:
func reloadData(){
chatroomTableView.reloadData()
chatroomTableView.scrollToBottom(true)
}
extension UITableView {
func scrollToBottom(animated: Bool = true) {
let sections = self.numberOfSections
let rows = self.numberOfRowsInSection(sections - 1)
if (rows > 0){
self.scrollToRowAtIndexPath(NSIndexPath(forRow: rows - 1, inSection: sections - 1), atScrollPosition: .Bottom, animated: true)
}
}
}
But it only scrolls down halfway.