I am working on an iOS 5 project with piped versions and thus using dynamic prototype table cells in IB. In one view, I have a table view with cells of variable height, with the height of the cell calculated from the height of the content.
tableView:heightForRowAtIndexPath: returns the correct values ββfor all cells when the table view is first displayed. All is well when several elements are scrolled, but then something is wrong: the actual cells seem to be the correct height, including their touch areas, but their separators appear in the wrong places (inside the cells, and not between them). A.
From the measurement of the placement of the separator, it seems that reusing the elements may have something to do with it. Separators for the first three cells are displayed correctly, but not the fourth. heightForRowAtIndexPath: returns the correct height for it (in this case 125 pixels), and the subviews it contains are in the right place. However, the separator is displayed only 108 pixels from the previous separator, placing it in the high-resolution area of ββ125 pixels of the cell.
Here's the kicker: 108px is the height of the first cell of the table, now out of sight and probably reused. I have no definite evidence of this, but it looks like the table view ignores heightForRowAtIndexPath: for these cells and just displays the separator according to the cell height again.
This does not explain why a bunch of later, shorter cells are not displayed at all. But thatβs all I have to go on.
Is there a workaround, setting up IB, or something else that might help?
Jk laiho
source share