In my UITableView
I use a method to scroll to the last cell:
WLNetworkClient.sharedClient().createCommentWIthText(commentTextView.text, forItem: item) { error in
defer {
UIAlertController.showAlertFromError(error)
}
if error == nil {
self.fetchedResultsController.fetchRequest.fetchLimit += 1
try! self.fetchedResultsController.performFetch()
self.tableView.reloadData()
self.scrollTableViewToBottom()
}
}
private func scrollTableViewToBottom() {
tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: fetchedResultsController.fetchedObjects!.count - 1, inSection: 0), atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
}
but this is not working as it is expected, because ALWAYS table is scrolled from the top even I am on the second cell to last. How to fix this?