I am using this code in cellForRowAtIndexPath
the problem is i change self.allItems and do a reloadData to the table view. The number of cells change but the cell appearance does not change. In fact it duplicates last 2 cells. It looks like CellIdentifier issue, it does not initialize the cell again once it is created already. How to solve this type of problems ?
moreover, where should i release this cell.
NSString *CellIdentifier = [NSString stringWithFormat"Cell%d", indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [CustomCell initWithFrame:CGRectZero withIdentifier:CellIdentifier withRecord:[self.allItems objectAtIndex:indexPath.row]];
}
return cell;
is it ok to do
if(cell != nil)
[cell release];
cell = [customCell alloc] initwithframe ....
everytime allocatiing the cell ?
regards
the problem is i change self.allItems and do a reloadData to the table view. The number of cells change but the cell appearance does not change. In fact it duplicates last 2 cells. It looks like CellIdentifier issue, it does not initialize the cell again once it is created already. How to solve this type of problems ?
moreover, where should i release this cell.
NSString *CellIdentifier = [NSString stringWithFormat"Cell%d", indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [CustomCell initWithFrame:CGRectZero withIdentifier:CellIdentifier withRecord:[self.allItems objectAtIndex:indexPath.row]];
}
return cell;
is it ok to do
if(cell != nil)
[cell release];
cell = [customCell alloc] initwithframe ....
everytime allocatiing the cell ?
regards