UITableView reloadSections : header view becomes blank

Discussion in 'iPhone/iPad Programming' started by namanhams, Dec 3, 2009.

  1. macrumors regular

    Joined:
    Jun 3, 2009
    #1
    Hi,

    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 :

    Code:
    [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.
     
  2. thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #2
    If i use
    Code:
    [self.tableView reloadData]
    instead, then everything works fine.

    The reason i use
    Code:
    [self.tableView reloadSections:sections withRowAnimation:UITableViewRowAnimationBottom];
    is because i want animation.
     
  3. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    You're supposed to wrap reloadSections in beginUpdates/endUpdates.
     
  4. thread starter macrumors regular

    Joined:
    Jun 3, 2009
    #4
    I did it but it makes no difference.
     
  5. macrumors 6502

    nashyo

    Joined:
    Oct 1, 2010
    Location:
    Bristol
    #5
    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.
     
  6. macrumors newbie

    roustk

    Joined:
    Jul 14, 2006
    #6
    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.
     

Share This Page