-(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;
}
本文深入探讨了iOS开发中使用Swift编程语言的关键技巧和最佳实践,包括基础语法、面向对象编程、错误处理、协程和并发编程等。通过实际案例分析,帮助开发者提升应用开发效率和代码质量。
599

被折叠的 条评论
为什么被折叠?



