I am using the estimatedRowHeight
method from UITableView in iOS 7, which works perfectly for fast loading of a UITableView with 5000 rows of variable heights.
Mine was wrong because the "atScrollPosition" was set to UITableViewScrollPositionNone
- change it to UITableViewScrollPositionMiddle
and it should work fine
This solved my problem
let oldContentSize = tableView.contentSize
tableView.scrollToRow(at: indexPath, at: .top, animated: true)
// Called again when tableView contentSize change
if !tableView.contentSize.equalTo(oldContentSize) {
tableView.scrollToRow(at: indexPath, at: .top, animated: true)
}
Unfortunately this issue is to be expected when using estimatedRowHeight
in your code with such a low value. When you scrollToRowAtIndexPath
it does not actively calculating the correct size as you go. The underlying cause is, if you scrolled from Section 1 to Section 2, it could feasibly calculate the correct position on the fly and the estimatedRowHeight
of the cells if it was a relatively new device. Any older devices would be brought to their knees, and even any new ones would be as well if you had to process 5000 cells, for example.
A maybe-solution to your problem could be to increase the estimatedRowHeight
constant so the device doesn't have to do as much work.