-(void)didSelectCellRowFirstDo:(BOOL)firstDoInsert nextDo:(BOOL)nextDoInsert
{
self.isOpen=firstDoInsert;
Cell1 *cell=(Cell1 *)[self.tableView cellForRowAtIndexPath:self.selectIndex];
[cell changeArrayWithUp:firstDoInsert];
[self.tableView beginUpdates];
long section=self.selectIndex.section;
long contentCount=[[[_dataList objectAtIndex:section]objectForKey:@"cat_list"]count];
NSMutableArray * rowToInsert=[[NSMutableArray alloc]init];
for (NSUInteger i=1; i<contentCount+1; i++) {
NSIndexPath*indexPathToInsert=[NSIndexPath indexPathForRow:i inSection:section];
[rowToInsert addObject:indexPathToInsert];
}
if (firstDoInsert) {
[self.tableView insertRowsAtIndexPaths:rowToInsert withRowAnimation:UITableViewRowAnimationTop];
}
else{
[self.tableView deleteRowsAtIndexPaths:rowToInsert withRowAnimation:
UITableViewRowAnimationTop];
}
[self.tableView endUpdates];
if (nextDoInsert) {
self.isOpen=YES;
self.selectIndex=[self.tableView indexPathForSelectedRow];
[self didSelectCellRowFirstDo:YES nextDo:NO];
}
if (self.isOpen) {
[self.tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}
{
self.isOpen=firstDoInsert;
Cell1 *cell=(Cell1 *)[self.tableView cellForRowAtIndexPath:self.selectIndex];
[cell changeArrayWithUp:firstDoInsert];
[self.tableView beginUpdates];
long section=self.selectIndex.section;
long contentCount=[[[_dataList objectAtIndex:section]objectForKey:@"cat_list"]count];
NSMutableArray * rowToInsert=[[NSMutableArray alloc]init];
for (NSUInteger i=1; i<contentCount+1; i++) {
NSIndexPath*indexPathToInsert=[NSIndexPath indexPathForRow:i inSection:section];
[rowToInsert addObject:indexPathToInsert];
}
if (firstDoInsert) {
[self.tableView insertRowsAtIndexPaths:rowToInsert withRowAnimation:UITableViewRowAnimationTop];
}
else{
[self.tableView deleteRowsAtIndexPaths:rowToInsert withRowAnimation:
UITableViewRowAnimationTop];
}
[self.tableView endUpdates];
if (nextDoInsert) {
self.isOpen=YES;
self.selectIndex=[self.tableView indexPathForSelectedRow];
[self didSelectCellRowFirstDo:YES nextDo:NO];
}
if (self.isOpen) {
[self.tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货