views:

1580

answers:

1

Hi,

I've got an iPhone UITableView displaying custom UITableViewCells that display on their right the disclosure-button icon.
When I swipe the cell, the disclosure button is automatically replaced by the red "Delete" button. If I press the "Delete" button the row is removed from the table, but then something strange happens.
When I scroll the table and the deleted cell is reused the data are correctly loaded but the disclosure button is missing.

I've tried to reset the button in the prepareForReuse message but without success.

I don't understand what I'm missing, because the behaviour seems the same of the Mail application so it should be natively supported by the iPhone OS.

Anyone can help me? Thanks in advance.

Stefano

BTW: The UITableViewCell is loaded from a NIB.

+1  A: 

Hi, it seems that I've solved the problem by adding in

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

this line of code:

[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];

I think this line is useless with normal cells but restore the right cell behaviour with cells reused after been deleted...

Anyway to delete the row I used in

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

this (I guess) standard line:

 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];

Thanks Stefano

Stefano Falda