我有一个包含8个单元格的tableView。当你点击单元格2时,我想要隐藏/取消隐藏单元格3-5。但是我不知道如何将这些单元格号码发送到高度,或者我在搞乱。我还需要知道在高度变化后如何刷新菜单。提前致谢。iOS TableViewCell单击目标单元格时隐藏/取消隐藏多个单元格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;
}
选择您的代码并点击控制+ k。它将正确格式化。这与问题无关。 –