2

I have a pretty standard UITableView that uses auto resizing cells

// Set the height of the table view cells
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 44.0;

When I push segue to a new view controller, the table view jumps to a different position. I've tried estimatedRowHeight, rowHeight, using the tableView methods, and nothing...

I've read these and nothing still really has worked. Anyone?

Table View Cells jump when selected on iOS 8

iOS 8 Auto cell height - didSelectRowAtIndexPath causes UItableview to jump to top

IOS 8 UITableView self-sizing cells jump/shift visually when a new view controller is pushed

Community
  • 1
  • 1
leerob
  • 2,876
  • 1
  • 18
  • 38
  • 1
    Have you implemented the method didSelectRowAtIndexPath:? – dminones Feb 01 '15 at 03:43
  • Yeah I have implemented it. – leerob Feb 01 '15 at 04:00
  • Could you share it? seems like the problem is there (cause the problem is whn you select una cell) – dminones Feb 01 '15 at 04:02
  • The code I posted for this answer should help. I have no longer seen the table jump when the push segue happens (either because the bug is fixed, or my estimated height is very accurate): http://stackoverflow.com/a/28267459/4151918 –  Feb 01 '15 at 21:04
  • This seems like a duplicate of this: http://stackoverflow.com/questions/27996438/jerky-scrolling-after-updating-uitableviewcell-in-place-with-uitableviewautomati/28376230?noredirect=1#comment51791456_28376230 See my answer – Gabriel Cartier Aug 11 '15 at 14:22

1 Answers1

4

It's a known issue.

I believe you'll find that the more the estimatedRowHeight differs from the actual height, the more the table will jump when the push segue happens. The workaround is to use a much better estimate (or to implement tableView:estimatedHeightForRowAtIndexPath: and return the exact height).

  • Could you share an example of this please? – leerob Feb 01 '15 at 19:11
  • You can use the same code you would have used in `tableView:heightForRowAtIndexPath:` before self-sizing cells came along. But I'd recommend trying to use a more accurate estimatedRowHeight, first, especially if your actual rows aren't 44 points high. You may find that a much better estimate is a good enough workaround for the issue. –  Feb 01 '15 at 19:58