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