The problem here:
if (cell == nil)
{
cell = (ThreePartitionCells *)[[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:customCell_Identifier] autorelease];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ThreePartitionCells" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
You initialize the cell from custom class, and then you assigned to the cell from a nib, so that you lose control of the first cell and you have not used the first cell.
Try this:
if (!cell){
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ThreePartitionCells"
owner:self
options:nil];
for (id obj in nib) {
if ([obj isKindOfClass:[ThreePartitionCells class]]) {
cell = (ThreePartitionCells *)obj;
break;
}
}
}
or:
if (!cell){
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"ThreePartitionCells"
owner:self
options:nil];
cell = nib[0];
}
or:
if (!cell){
cell = [[[ThreePartitionCells alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:customCell_Identifierr] autorelease];
}