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

-(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;

}

你可能感兴趣的:(QQ列表的收缩展开,带动画效果)