1

I'm having weird overlapping when i try to reloadData of the tableView, causing the cell's height to change (using UITableViewAutomaticDimension), then the content get overlapped with the cell above it, cant figure out how to do it :/

Before: enter image description here enter image description here

After reload the view from under cell jump to above: enter image description here

They are basically the same cell but the top one have that View height = 0 and have no data, And it only happen if the bottom cell is fullscreen (top cell is invisible), if the Revenue per hour cell is visible then this bugs wont appear

Tj3n
  • 9,837
  • 2
  • 24
  • 35
  • Could it have something to do with `automaticallyAdjustsScrollViewInsets` (see http://stackoverflow.com/a/19585104/1305067) – paulvs Apr 13 '16 at 03:12
  • I don't think this have anything to do with that, its just for tableview overlap navigation bar, my issue is probably from reusing mechanism but i'm not sure what is it – Tj3n Apr 13 '16 at 03:19

1 Answers1

1

This is probably due to set the same cell identifier, do you refresh cells before reusing them?

    - (void)prepareForReuse {    }

Implement this method on your table view cell classes. Hope this would be helpful to you.

HSG
  • 1,224
  • 11
  • 17
  • what should i do in this function? – Tj3n Apr 13 '16 at 03:17
  • Your cell carries some logics that control the UI for example based on data, it will behave differently. However, because of using the same identifier, the reusable cell get from the recycle array still keeps its old state. "prepareForResuse" called before it will be used, you should refresh it. – HSG Apr 13 '16 at 03:21
  • I'm using tableView inside Viewcontroller and this method doesn't seems to exist :/ ...Is it from tableViewcontroller? – Tj3n Apr 13 '16 at 03:22
  • That "prepareForReuse" method belongs to UITableViewCell class :) – HSG Apr 13 '16 at 03:24
  • It seems to work but now it breaking some logic that cause the below cell to use the upper cell data, i will try to see what causing it :) thanks – Tj3n Apr 13 '16 at 03:34