0

I have a tableview which, when displaying more than X items, displays section headers:

30

When I delete the last item to go below X (and therefore remove the section headers), the header view heights get updated correctly but the views themselves are left sticking:

withoutheaders

As soon as I start scrolling the tableview, they go away.

Any idea on how to fix this? (calling reloadData obviously does, but seems like a nasty and unnecessarily expensive solution).

Community
  • 1
  • 1
samvermette
  • 40,269
  • 27
  • 112
  • 144

1 Answers1

0

Are you calling setNeedsLayout or setNeedsDisplay to trigger the redrawing of the sub views?

Community
  • 1
  • 1
Dave Anderson
  • 11,836
  • 3
  • 58
  • 79
  • Of the section header views? Why would I do that? The views are returned by `tableView:viewForHeaderInSection:` (which I'm making return `nil` when my dataSource.count < X) – samvermette Mar 13 '13 at 07:22
  • Of the `tableView` so it redraws without the header which you've set to nil. The scroll event is triggering the redraw which makes it go away. – Dave Anderson Mar 13 '13 at 22:23
  • 1
    Neither `setNeedsDisplay` or `setNeedsLayout` seems to fix my issue. Wonder what else the scroll event is triggering that makes them go away... – samvermette Mar 15 '13 at 03:58
  • @samvermette were you able to fix the issue? – vinnybad Oct 29 '15 at 04:31