Vous devez enregistrer indexPath pour la ligne sélectionnée. Vous pouvez mettre une condition dans cellForRow à peu près de même.
est par exemple de tri ici:
Declare variables dans un fichier .h:
int selectedIndexPath;
.m
-(void)viewDidLoad
{
[super viewDidLoad];
// So it won't show any select for the first time
selectedIndexPath = -1;
[tableView reloadData];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
int currentRow = (int)indexPath.row;
if(currentRow == selectedIndexPath)
{
// Show your base cell
}
else
{
// Show detail cell
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
selectedIndexPath = (int)indexPath.row;
[tableView reloadData];
}