@@ -123,8 +123,8 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
123
123
}
124
124
125
125
- (void )initializeVars {
126
- _numberOfSectionsCalled = NO ;
127
126
_sectionInfos = [NSMutableArray new ];
127
+ _numberOfSectionsCalled = NO ;
128
128
_allowMultipleSectionsOpen = NO ;
129
129
_enableAnimationFix = NO ;
130
130
_keepOneSectionOpen = NO ;
@@ -140,12 +140,8 @@ - (BOOL)isAlwaysOpenedSection:(NSInteger)section {
140
140
return [self .sectionsAlwaysOpen containsObject: @(section)];
141
141
}
142
142
143
- - (void )addOpenedSection : (NSInteger )section { // KRIS TODO: Rename this to markSectionOpen
144
- [self .sectionInfos[section] setOpen: YES ];
145
- }
146
-
147
- - (void )removeOpenedSection : (NSInteger )section {
148
- [self .sectionInfos[section] setOpen: NO ];
143
+ - (void )markSection : (NSInteger )section open : (BOOL )open {
144
+ [self .sectionInfos[section] setOpen: open];
149
145
}
150
146
151
147
- (NSArray *)getIndexPathsForSection : (NSInteger )section {
@@ -345,7 +341,7 @@ - (void)openSection:(NSInteger)section withHeaderView:(FZAccordionTableViewHeade
345
341
}
346
342
}
347
343
348
- [self addOpenedSection : section];
344
+ [self markSection : section open: YES ];
349
345
[self beginUpdates ];
350
346
[CATransaction setCompletionBlock: ^{
351
347
if ([self .subclassDelegate respondsToSelector: @selector (tableView:didOpenSection:withHeader: )]) {
@@ -361,7 +357,7 @@ - (void)closeSection:(NSInteger)section withHeaderView:(FZAccordionTableViewHead
361
357
[self .subclassDelegate tableView: self willCloseSection: section withHeader: sectionHeaderView];
362
358
}
363
359
364
- [self removeOpenedSection : section];
360
+ [self markSection : section open: NO ];
365
361
[self beginUpdates ];
366
362
[CATransaction setCompletionBlock: ^{
367
363
if ([self .subclassDelegate respondsToSelector: @selector (tableView:didCloseSection:withHeader: )]) {
@@ -404,7 +400,7 @@ - (void)autoCollapseAllSectionsExceptSection:(NSInteger)section {
404
400
405
401
// Delete the cells for section that is closing
406
402
NSArray *indexPathsToDelete = [self getIndexPathsForSection: sectionToClose.integerValue];
407
- [self removeOpenedSection : sectionToClose.integerValue];
403
+ [self markSection : sectionToClose.integerValue open: NO ];
408
404
409
405
[self beginUpdates ];
410
406
[CATransaction setCompletionBlock: ^{
@@ -453,7 +449,6 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
453
449
// There is some potential UITableView bug where
454
450
// 'tableView:numberOfRowsInSection:' gets called before
455
451
// 'numberOfSectionsInTableView' gets called.
456
- NSLog (@" ENCOUNTERED UITABLEVIEW BUG" );
457
452
return 0 ;
458
453
}
459
454
0 commit comments