self.isOpen = [NSMutableArray array];
for (int j = 0; j < i; j++) {
[self.isOpen addObject:[NSNumber numberWithInt:0]];
}
-(void)buttonClick:(UIButton*)button
{
NSNumber *num = self.isOpen[tag];
if(num.intValue == 1){
[self.isOpen removeObjectAtIndex:tag];
[self.isOpen insertObject:[NSNumber numberWithInt:0] atIndex:tag];
} else
{
[self.isOpen removeObjectAtIndex:tag];
[self.isOpen insertObject:[NSNumber numberWithInt:1] atIndex:tag];
}
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:tag] withRowAnimation:UITableViewRowAnimationFade];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
-(NSInteger)tableView:(UITableView *)tableViewnumberOfRowsInSection:(NSInteger)section
{
NSNumber *num = [self.isOpen objectAtIndex:section];
if(num.intValue == 1)
{
return 4;
}else{
return 0;
}
}