Scrolling to the last row of the table only looks to scroll halfway

I try to go to the last row of the table view after the user has added a comment to the feed:

self.loadDataFromParse();

// load the last row
let numberOfSections = self.tableView.numberOfSections()
let numberOfRows = self.tableView.numberOfRowsInSection(numberOfSections-1)

if numberOfRows > 0 {
     println(numberOfSections)
     let indexPath = NSIndexPath(forRow: numberOfRows-1, inSection: (numberOfSections-1))
     self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
}

But tableviewonly scrolls about half / 3/4 of the way. Any input is appreciated.

+4
source share
1 answer

This solution may be useful to others with the same problem. This problem is a bug; see the discussion here .

, , :

self.tableView.reloadData();

            // load the last row


            let offset = CGPoint(x: 0, y: self.tableView.contentSize.height - self.tableView.frame.size.height + self.FOOTERHEIGHT);

            self.tableView.contentOffset = offset;
0

All Articles