, BOOL. expanded BOOL s, , .
*isExpanded = !*isExpanded;
BOOL. , .
, , , deleteRowsAtIndexPaths:withRowAnimation: UITableView. - deleteSections:withRowAnimation: . insert...
, BOOL s. NSMutableArray .
, , expanded NO.
NSMutableArray * expandedStatuses;
@property (nonatomic, retain) NSMutableArray * expandedStatuses;
self.expandedStatuses = [NSMutableArray array];
for ( int i = 0; i < numberOfSections; i++ ) {
[self.expandedStatuses addObject:[NSNumber numberWithBool:NO]];
}
, toggle:section: ,
BOOL expanded = [[self.expandedStatuses objectAtIndex:section] boolValue];
[self.expandedStatuses replaceObjectAtIndex:section withObject:[NSNumber numberWithBool:!expanded]];
,
[self.expandedStatuses removeObjectAtIndex:sectionIndexToDelete]
,
[self.expandedStatuses addObject:[NSNumber numberWithBool:NO]];
[self.expandedStatuses insertObject:[NSNumber numberWithBool:NO] atIndex:sectionIndexToInsertAt];
NSMutableArray . .