views:

386

answers:

1

I have a grouped table view that utilizes two different custom table cells.

When i scroll through the table so that one (or more) of the cells goes either above or below what is visible those cells become blank. When i scroll back up (or down) to view these cells they are still blank. Why is this? The cells showed the appropriate content when they were first loaded.

Here is the code that loads the cells at the specified indexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    if(indexPath.section==0)
    {
     FMLFullTextCell = (FullTextCell *) [tableView dequeueReusableCellWithIdentifier:FullTextCell_ID];
     if(FMLFullTextCell==nil)
     {
      [[NSBundle mainBundle]loadNibNamed:@"FullTextCell" owner:self options:nil];
      [FMLFullTextCell initWithFMLText:@"Here is some demo fml text"];
     }
     return FMLFullTextCell;
    }
    else
    {
     FMLAuthorCell=(Author *)[tableView dequeueReusableCellWithIdentifier:AuthorCell_ID];
     if(FMLAuthorCell==nil)
     {
      [[NSBundle mainBundle]loadNibNamed:@"Author" owner:self options:nil];
      [FMLAuthorCell initWithTitle:@"Author" initWithAuthor:@"JohnnyAuthor"];
     }
     return FMLAuthorCell;
    }

}
+2  A: 

You did not provide enough information to answer this question.

Usually UITableViewCells get cached when created via initWithFrame:reuseIdentifier: and accesed via dequeueReusableCellWithIdentifier:. My guess would be, that you did not specify different reuse identifier for your two different custom table cells, and because of that they get mixed up in your code somehow. This might cause the described behavior.

Anyway, without seeing some code, this is hard to answer. You should at least show us the tableView:cellForRowAtIndexPath method of your datasource.

rincewind
i updated the code with the specified method - I tried using the custom identifiers- but am stil getting the same problem... any thoughts??
zPesk
nevermind i fixed it - i did not add this identifier to the xib files
zPesk