I have a table view section with two custom cells. I want to swap the cells in that section when the some other action triggers.

The top cell should slide to the bottom, and the bottom cell should slide to the top.
My current code results in blank cells’ area

when cellForRowAtIndexPath returns:
// flag is set to YES when reloadSections is called
if (flag) {
if (self.currentAddressingMode == AddressingModeToSelf) {
if (indexPath.row == 0) {
return self.outNumberCell;
}
else if (indexPath.row == 1) {
return self.inNumberCell;
}
}
else if (self.currentAddressingMode == AddressingModeToCounterpart) {
if (indexPath.row == 0) {
return self.inNumberCell;
}
else if (indexPath.row == 1) {
return self.outNumberCell;
}
}
}
Is there a solution?
I’ve solved this question by creating custom cells in the
cellForRowAtIndexPath:method (by adding subviews to them), instead of subclassing. For animated cell swapping I used theUITableView‘smoveRowAtIndexPath:toIndexPath:method (iOS 5 SDK). The other related methods work fine too (it depends of the swapping animation that you need). The code chunk that I posted to this question remains completely unchanged.