I know cellForRowAtIndexPath is getting called initially for every cell. The height of the cells is 89.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UILabel *textName = nil;
UIImageView* image = nil;
unsigned int DATA_TAG = 1001;
unsigned int IMG_TAG = 1002;
// Retrieve a cell is Available
cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Check if no new cell was available
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
// Set the Accessory Data
textName = [[[UILabel alloc]initWithFrame:CGRectMake(cell.frame.origin.x, 80, cell.frame.size.width, 20)]autorelease];
textName.tag = DATA_TAG;
textName.textAlignment = UITextAlignmentCenter;
textName.backgroundColor = [UIColor clearColor];
textName.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0];
textName.textColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
textName.lineBreakMode = UILineBreakModeWordWrap;
[cell.contentView addSubview:textName];
//Set the Image Data
image = [[[UIImageView alloc]initWithFrame:CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, 80)]autorelease];
image.tag = IMG_TAG;
image.contentMode= UIViewContentModeScaleAspectFit;
[cell.contentView addSubview:image];
}
Accessory* acc= [[AccessoryManager sharedManager].currentList objectAtIndex:indexPath.row];
if(acc == nil)
return cell;
textName= (UILabel*)[cell.contentView viewWithTag:DATA_TAG];
textName.text= acc.accessoryName;
image= (UIImageView*)[cell.contentView viewWithTag:IMG_TAG];
[image setImage:acc.accessoryImage];
return cell;
}