Reputation: 171
I encountered this problem when using UITableView, the tableView's cells have different heights, and the auto layout constraints are set properly. When you scroll down to the bottom of tableView and load more data (no matter by using reloadData or insertRowsAtIndexPaths), and then scroll up, the tableView will start to be jumpy at some point, and then be jumpy all the time until you scroll to the very top.
Not only for my own project, I find this project on github (link) have the same problem so that you can reproduce it.
Upvotes: 3
Views: 1508
Reputation: 529
Did you solve the problem? I finally solved this issue, the key is to calculate an estimated height. Seems like the more accurate estimate you return, the less jumpiness/choppiness.
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
switch (yourTypeOfCell) {
case something:
return estimatedHeight;
break;
case default:
return defaultValue;
break;
}
}
Upvotes: 1