Project needs to make a similar QQ contact folding table, the idea is simple: Set the header of each section, display the group name on the header, and then according to the collapse or not, set the number of cells in each section, if collapsed, set it to 0, Otherwise set to the actual number of cells, then refresh the table.
So here's the question:
1. If you use a Uitableviewstyleplain-style table, the header will hover over the top when the table slides, rather than sliding along the table.
2. If a uitableviewstylegrouped style table is used, the Tableview:viewforheaderinsection: The section value starts at 1 instead of 0
Solution:
Issue 1: Set the style of the table to uitableviewstylegrouped so that the header slides with the table and does not hover over the top. However, the style will change, because the uitableviewstylegrouped table will have the default header and footer height (as if it is 13), according to their own needs, the corresponding header and footer can be set.
Issue 2: The reason for this is that it should be a bug to set the header height using sectionheaderheight instead of using the delegate method (Tableview:heightforheaderinsection:).
Folding table ideas and problems encountered (Tableview:viewforheaderinsection: section starting from 1, not starting from 0)