Skip to content

Commit 1658474

Browse files
author
Ernesto Rivera
committed
Simplify code and minor changes
1 parent 9b7406a commit 1658474

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Source/AMBTableViewController.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,11 @@ - (void)updateAllSections
183183

184184
- (void)combineChanges:(void (^)(void))changes
185185
{
186-
if (self.tableView)
187-
{
188-
[self.tableView beginUpdates];
189-
}
186+
[self.tableView beginUpdates];
190187

191188
changes();
192189

193-
if (self.tableView)
194-
{
195-
[self.tableView endUpdates];
196-
}
190+
[self.tableView endUpdates];
197191
}
198192

199193
- (NSIndexPath *)indexPathForRowWithSubview:(UIView *)subview
@@ -413,7 +407,7 @@ - (void)setObjects:(NSArray *)objects
413407
_hiddenObjectsMutableIndexSet = [NSMutableIndexSet indexSet];
414408
[self updateVisibleObjects];
415409

416-
// Update table view
410+
// Reload section
417411
[self reload];
418412
}
419413

@@ -682,7 +676,8 @@ - (void)insertRowsWithIndexes:(NSIndexSet *)rowIndexSet
682676
{
683677
if (self.controller.tableView)
684678
{
685-
[self.controller.tableView insertRowsAtIndexPaths:[self indexPathsForRowIndexes:rowIndexSet]
679+
NSArray * indexPaths = [self indexPathsForRowIndexes:rowIndexSet];
680+
[self.controller.tableView insertRowsAtIndexPaths:indexPaths
686681
withRowAnimation:self.controller.insertAnimation];
687682
}
688683
}
@@ -691,7 +686,8 @@ - (void)deleteRowsWithIndexes:(NSIndexSet *)rowIndexSet
691686
{
692687
if (self.controller.tableView)
693688
{
694-
[self.controller.tableView deleteRowsAtIndexPaths:[self indexPathsForRowIndexes:rowIndexSet]
689+
NSArray * indexPaths = [self indexPathsForRowIndexes:rowIndexSet];
690+
[self.controller.tableView deleteRowsAtIndexPaths:indexPaths
695691
withRowAnimation:self.controller.removeAnimation];
696692
}
697693
}

0 commit comments

Comments
 (0)