implementation of collapsing tableView Cells
so I wanted to have a table with multiple sections and each one with multiple cells. By touching开发者_StackOverflow a section's header, this section should expand and the others should minimize, leaving only the header visible.
I looked up some suggestions and accomplished this by a) setting the cell's height to 0 and reloding the data animated and b) adding a button as a subview to the cell's header.
Anyway, while it works fine, mainly, there is minor problem, namely, I can see a 'flickering' below each cell's header, when the change is animated. I guess its because the cell's content is redrawn. And I don't like it!
I wanted to ask whether the approach is correct or generally your opinion about it. Moreover I would be really happy, if someone could hint me why the 'flickering' appears in my table :)
EDIT: Another thing is, that if I press on a section, it appears like all the section headers are pressed.... maybe someone has seen this weird artifact also?
You should remove cells instead of setting height to 0.
You will have less call to data source and delegate and no more artifacts.
精彩评论