8

I'm using a UITableView in my iOS app, and have been seeing a strange issue recently.

Suppose my table is structured as follows:

section 1 header
row 
section 2 header
section 3 header
row
row 
...

(Note that section 2 has no rows)

I'm performing updates to the rows in my table via

    [self.tv beginUpdates];
    [self.tv reloadRowsAtIndexPaths:ip withRowAnimation:UITableViewRowAnimationNone];
    [self.tv endUpdates];

I don't want any animations taking place. I just want the row to update. The issue is that this strategy works for every row and section in the my table except section 3, row 1: the first row of the last section. When I update this row (which is indeed using the correct indexPaths), rather than get no animation, the row does this little jump, like it's sliding in a new row to replace the old one or something. The row slides up ever so slightly, then back down, as if I was inserting a row. I'm guessing it has something to do with the header calculations, but I do return correct values for heightForHeaderInSection.

Has anyone seen this behavior?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
jimt
  • 1,980
  • 2
  • 21
  • 28

2 Answers2

0

I wonder if the beginUpdates and endUpdates are necessary in this reload only scenario.

VdesmedT
  • 9,037
  • 3
  • 34
  • 50
  • Have you tried changing the withRowAnimation param to check that it a least animate the way you ask when you do ? – VdesmedT Dec 30 '10 at 10:58
  • Well, it actually doesn't animate the way I'm telling it to. It always does the little jump regardless of which animation I specify. Does that mean anything? – jimt Jan 06 '11 at 07:37
-1

I had the same problem. The solution was to fetch the cell from the table using:

UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:indexPath]

and then refresh it manually using a custom setup method or by simply calling:

[cell setNeedsLayout]

For more info, see:

UITableView reloadRowsAtIndexPaths graphical glitch

Community
  • 1
  • 1
martin
  • 132
  • 1
  • 4
  • This solution didn't work for me. In NSFetchedResultsChangeMove I'm trying to update the cell as well as calling moveRowAtIndexPath. – malhal Sep 01 '15 at 20:53