I want to add rows to a table view without the visible cells being moved, similarly to Twitter for iPhone, Tweetbot and several others. Every method I have tried thus far accomplishes that eventually, but does funky animations in between. Here is the current solution, which moves cells around but eventually ends up staying in the same place.
- (void)controllerDidChangeContent:(NSFetchedResultsController*)controller
{
UITableViewCell *referenceCell;
if ([self.tableView.visibleCells count] > 0) {
referenceCell = [self.tableView.visibleCells lastObject];
}
CGFloat offset = referenceCell.frame.origin.y - self.tableView.contentOffset.y;
[self.tableView endUpdates];
[self.tableView setContentOffset:CGPointMake(0.0, referenceCell.frame.origin.y - offset) animated:NO];
}