-(void)sectionHeaderView:(QQSectionHeaderView*)sectionHeaderView sectionClosed:(NSInteger)section
{
QQList *persons = [lists objectAtIndex:section];
persons.opened = !persons.opened;
// 收缩+动画 (如果不需要动画直接reloaddata)
NSInteger countOfRowsToDelete = [self.tableView numberOfRowsInSection:section];
if (countOfRowsToDelete > 0) {
persons.indexPaths = [[NSMutableArray alloc] init];
for (NSInteger i = 0; i < countOfRowsToDelete; i++) {
[persons.indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:section]];
}
[self.tableView deleteRowsAtIndexPaths:persons.indexPaths withRowAnimation:UITableViewRowAnimationTop];
}
}
-(void)sectionHeaderView:(QQSectionHeaderView*)sectionHeaderView sectionOpened:(NSInteger)section
{
QQList *persons = [lists objectAtIndex:section];
persons.opened = !persons.opened;
// 展开+动画 (如果不需要动画直接reloaddata)
if(persons.indexPaths){
[self.tableView insertRowsAtIndexPaths:persons.indexPaths withRowAnimation:UITableViewRowAnimationBottom];
}
persons.indexPaths = nil;
}