0
我有展开/折叠选项时,用户敲击页脚中的按钮,但我不想表崩溃一路一个UITableView,我想很少细胞始终保持可见状态,并从该点开始展开并折叠至该点。我的表格视图有三个部分,每个部分的可见单元格数目可以不同。当单击自定义页脚按钮时,我可以一路展开并折叠它,但正努力为不同部分保留不同数量的可见单元格。 (我使用NIB和新的使用Objective-C) 在此先感谢,任何进一步的说明,请让我知道。UITableView的多段展开/收起保持几个细胞始终可见
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
static NSString *cellIdentifier = @"FOOTER";
CustomFootrCell *customFooter=[tableView dequeueReusableHeaderFooterViewWithIdentifier:cellIdentifier];
//Section shoud be 'section'
[customFooter.expandButton setTag:section];
[customFooter.expandButton addTarget:self action:@selector(expandButton:)forControlEvents:UIControlEventTouchUpInside];
return customFooter;
}
-(void)expandButton: (id)sender{
//Here all my conditons to decide if that section is expanded/collapsed
//And update it accordingly on numberOfRowsInSection method
//Add begin and end for animation
[self.myTablebeginUpdates];
[self.myTable reloadSections:[NSIndexSet indexSetWithIndex:[sender tag]] withRowAnimation:UITableViewRowAnimationAutomatic];
[self.myTableendUpdates];
}
非常感谢您的快速回复。我将尝试一下,看看它是否有效。你的git示例项目是合法的:) – Tanvir