Skip to content

Commit 7f97f73

Browse files
committed
Small refactoring.
1 parent df34dab commit 7f97f73

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

FZAccordionTableView/FZAccordionTableView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
/*!
112112
@desc Finds the section of a header view.
113113
114-
@param headerView The header view whose section you want to find.
114+
@param headerView The header view whose section must be found.
115115
116116
@returns The section of the header view.
117117
*/

FZAccordionTableView/FZAccordionTableView.m

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,15 @@ - (void)markSection:(NSInteger)section open:(BOOL)open {
145145
}
146146

147147
- (NSArray *)getIndexPathsForSection:(NSInteger)section {
148-
149148
NSInteger numOfRows = [self.sectionInfos[section] numberOfRows];
150149
NSMutableArray *indexPaths = [NSMutableArray array];
151150
for (int row = 0; row < numOfRows; row++) {
152151
[indexPaths addObject:[NSIndexPath indexPathForRow:row inSection:section]];
153152
}
154-
155153
return indexPaths;
156154
}
157155

158-
- (void)toggleSection:(NSInteger)section {
159-
156+
- (void)toggleSection:(NSInteger)section {
160157
FZAccordionTableViewHeaderView *headerView = (FZAccordionTableViewHeaderView *)[self headerViewForSection:section];
161158
[self tappedHeaderView:headerView];
162159
}
@@ -224,10 +221,9 @@ - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAn
224221
}
225222
}
226223

227-
- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
228-
{
224+
- (void)insertRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation {
229225
for (NSIndexPath *indexPath in indexPaths) {
230-
NSAssert([self.sectionInfos[indexPath.section] isOpen], @"Can't insert rows in a closed section: %d.", (int)indexPath.section);
226+
NSAssert([self isSectionOpen:indexPath.section], @"Can't insert rows in a closed section: %d.", (int)indexPath.section);
231227
}
232228
[super insertRowsAtIndexPaths:indexPaths withRowAnimation:animation];
233229
}

0 commit comments

Comments
 (0)