@@ -27,6 +27,15 @@ @implementation AMBTableViewController
2727
2828@dynamic sections;
2929
30+ - (void )awakeFromNib
31+ {
32+ [super awakeFromNib ];
33+
34+ self.reloadAnimation = UITableViewRowAnimationNone;
35+ self.insertAnimation = UITableViewRowAnimationAutomatic;
36+ self.removeAnimation = UITableViewRowAnimationAutomatic;
37+ }
38+
3039- (NSString *)description
3140{
3241 return [[[[[NSString stringWithFormat: @" <%@ : %p ; sections: %@ >" , NSStringFromClass (self .class), self , self .sections]
@@ -74,7 +83,7 @@ - (void)insertSection:(AMBTableViewSection *)section
7483 [section update ];
7584
7685 [self .tableView insertSections: [NSIndexSet indexSetWithIndex: index]
77- withRowAnimation: UITableViewRowAnimationAutomatic ];
86+ withRowAnimation: self .insertAnimation ];
7887}
7988
8089- (void )removeSection : (AMBTableViewSection *)section
@@ -92,7 +101,7 @@ - (void)removeSectionAtIndex:(NSUInteger)index
92101 [_mutableSections removeObjectAtIndex: index];
93102
94103 [self .tableView deleteSections: [NSIndexSet indexSetWithIndex: index]
95- withRowAnimation: UITableViewRowAnimationAutomatic ];
104+ withRowAnimation: self .removeAnimation ];
96105}
97106
98107- (void )replaceSection : (AMBTableViewSection *)sectionToReplace
@@ -542,7 +551,7 @@ - (void)reload
542551 {
543552 NSUInteger sectionIndex = [self .controller.sections indexOfObject: self ];
544553 [self .controller.tableView reloadSections: [NSIndexSet indexSetWithIndex: sectionIndex]
545- withRowAnimation: UITableViewRowAnimationNone ];
554+ withRowAnimation: self .controller.reloadAnimation ];
546555 }
547556}
548557
@@ -573,7 +582,7 @@ - (void)reloadObjectsAtIndexes:(NSIndexSet *)indexSet
573582 {
574583 NSArray * pathsToReload = [self indexPathsForRowIndexes: [self rowIndexSetForVisibleObjectsInIndexSet: visibleObjectIndexesToReload]];
575584 [self .controller.tableView reloadRowsAtIndexPaths: pathsToReload
576- withRowAnimation: UITableViewRowAnimationNone ];
585+ withRowAnimation: self .controller.reloadAnimation ];
577586 }
578587 }
579588}
@@ -630,7 +639,7 @@ - (void)insertRowsWithIndexes:(NSIndexSet *)rowIndexSet
630639 if (self.controller .tableView )
631640 {
632641 [self .controller.tableView insertRowsAtIndexPaths: [self indexPathsForRowIndexes: rowIndexSet]
633- withRowAnimation: UITableViewRowAnimationFade ];
642+ withRowAnimation: self .controller.insertAnimation ];
634643 }
635644}
636645
@@ -639,7 +648,7 @@ - (void)deleteRowsWithIndexes:(NSIndexSet *)rowIndexSet
639648 if (self.controller .tableView )
640649 {
641650 [self .controller.tableView deleteRowsAtIndexPaths: [self indexPathsForRowIndexes: rowIndexSet]
642- withRowAnimation: UITableViewRowAnimationFade ];
651+ withRowAnimation: self .controller.removeAnimation ];
643652 }
644653}
645654
0 commit comments