您的位置:首页 > 其它

QQ列表的收缩展开,带动画效果

2011-09-14 14:18 267 查看
-(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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: