View Full Version : UITableView reloadSections : header view becomes blank

Dec 3, 2009, 06:38 AM

I have a UITableView with some sections, each has its own header view.
When user taps on the header view of a section, all rows of that section will collapse. What i do is, I set the number of row of that section to 0, and then call :

[self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationBottom];

Everything works as expected, except 1 thing : the header view of the section becomes white blank. When i scroll the table, then the header becomes normal again.

So i guess there's some problem with the drawing of the table.

1 funny thing is, if i use UITableViewRowAnimationFade instead, then even when i scroll the table, the header is still white blank.

Dec 3, 2009, 10:36 AM
If i use
[self.tableView reloadData]

instead, then everything works fine.

The reason i use
[self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationBottom];

is because i want animation.

Dec 3, 2009, 11:22 AM
You're supposed to wrap reloadSections in beginUpdates/endUpdates.

Dec 3, 2009, 09:06 PM
I did it but it makes no difference.

Aug 27, 2012, 02:24 PM
I did it but it makes no difference.

Did you solve this all those years ago? I'm having a similar problem where the animation is causing my custom header view to move upwards about a new headerview. It looks weird.

I just want the animation.

Sep 14, 2012, 12:56 AM
You are probably caching the header views. If you do, make sure to clear the cache, do not reuse the views when you change the table view.