i have a grouped style tableview where each group exists in an expanded or collapsed state. in the collapsed state, the first cell is kind of a header cell, and is 71 pixels in height. the 2nd cell is only 21 pixels in height, and is used to simulate the look of something of a container. so it really is having the cell separator there that gives an indication that there is more than one cell there.
when the user taps on the first cell, all the cells that belong in the expanded state are animated in with the following code:
Code:
if (rowsToAnimate)
{
[tableView beginUpdates];
{
if (insertRows)
{
[tableView insertRowsAtIndexPaths:rowsToAnimate withRowAnimation:UITableViewRowAnimationMiddle];
}
else
{
[tableView deleteRowsAtIndexPaths:rowsToAnimate withRowAnimation:UITableViewRowAnimationMiddle];
}
}
[tableView endUpdates];
}
all very straight forward, and works as you would expect.
the problem is this: the background color of the cells does not match the background view of the tableview, and so when animating you see the outline of the 2nd to last cell as the section is collapsing to just the 2 cells, or expanding to more than the two cells.
it looks like what is happening is the animated cells, which are always in between the first and last cell, are either drawn or removed first, and then the shift is made to move the last cell away from the first or up to it.
it is much more pronounced when there is only one cell in between the two.
if the last cell is the same height of the first cell, there is no issue. i found that the last cell has to be around 39 pixels in height to cover the result of the animation, but then that completely takes away from the look that the designers are after.
i am going to try always deleting that last cell and re-adding it on every animation, but that will take a little change in the code.
was wondering if anyone has any ideas, or if my explanation is clear?