J'ai une tableView qui a 8 cellules. Lorsque vous cliquez sur la cellule 2, je veux cacher/afficher les cellules 3-5.Mais je ne sais pas comment envoyer ces numéros de cellules à la hauteur ou je suis en train de déconner. J'ai aussi besoin de savoir comment actualiser le menu après que la hauteur soit modifiée. Merci d'avance.iOS TableViewCell Cacher/afficher plusieurs cellules en cliquant sur une cellule avec l'objectif C
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if([indexPath row] == 1){
'';//
}else if([indexPath row] == 2){
if(viewCells ==0){
viewCells =1;
// What needs to be here to change the 3-5 index height
}else{
viewCells =0;
// What needs to be here to change the 3-5 index height
}
}else if([indexPath row] == 3){
//
}else if([indexPath row] == 4){
//
}else if([indexPath row] == 5){
//
}else if([indexPath row] == 6){
//
}else if([indexPath row] == 7){
//
}else if([indexPath row] == 8){
//
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(viewCells==0){
return 44;
}else{
return 0;
}
return 44;
}
Sélectionnez votre code et cliquez sur OK. Il va le formater correctement. Cela n'a rien à voir avec la question. –