Fix Collection View

This commit is contained in:
Li Tan 2015-01-08 16:27:57 -08:00
parent 1068fdc413
commit 90cb725b39

View File

@ -14,6 +14,8 @@
#import "ASDataController.h" #import "ASDataController.h"
#import "ASDisplayNodeInternal.h" #import "ASDisplayNodeInternal.h"
const static NSUInteger kASCollectionViewAnimationNone = 0;
#pragma mark - #pragma mark -
#pragma mark Proxying. #pragma mark Proxying.
@ -137,7 +139,7 @@ static BOOL _isInterceptedSelector(SEL sel)
ASDisplayNodePerformBlockOnMainThread(^{ ASDisplayNodePerformBlockOnMainThread(^{
[super reloadData]; [super reloadData];
}); });
[_dataController reloadData]; [_dataController reloadDataWithAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)setDataSource:(id<UICollectionViewDataSource>)dataSource - (void)setDataSource:(id<UICollectionViewDataSource>)dataSource
@ -202,42 +204,42 @@ static BOOL _isInterceptedSelector(SEL sel)
- (void)insertSections:(NSIndexSet *)sections - (void)insertSections:(NSIndexSet *)sections
{ {
[_dataController insertSections:sections]; [_dataController insertSections:sections withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)deleteSections:(NSIndexSet *)sections - (void)deleteSections:(NSIndexSet *)sections
{ {
[_dataController deleteSections:sections]; [_dataController deleteSections:sections withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)reloadSections:(NSIndexSet *)sections - (void)reloadSections:(NSIndexSet *)sections
{ {
[_dataController reloadSections:sections]; [_dataController reloadSections:sections withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection
{ {
[_dataController moveSection:section toSection:newSection]; [_dataController moveSection:section toSection:newSection withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths
{ {
[_dataController insertRowsAtIndexPaths:indexPaths]; [_dataController insertRowsAtIndexPaths:indexPaths withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths
{ {
[_dataController deleteRowsAtIndexPaths:indexPaths]; [_dataController deleteRowsAtIndexPaths:indexPaths withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths
{ {
[_dataController reloadRowsAtIndexPaths:indexPaths]; [_dataController reloadRowsAtIndexPaths:indexPaths withAnimationOption:kASCollectionViewAnimationNone];
} }
- (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath
{ {
[_dataController moveRowAtIndexPath:indexPath toIndexPath:newIndexPath]; [_dataController moveRowAtIndexPath:indexPath toIndexPath:newIndexPath withAnimationOption:kASCollectionViewAnimationNone];
} }
@ -367,7 +369,7 @@ static BOOL _isInterceptedSelector(SEL sel)
return [_dataController nodesAtIndexPaths:indexPaths]; return [_dataController nodesAtIndexPaths:indexPaths];
} }
- (void)rangeController:(ASRangeController *)rangeController didInsertNodesAtIndexPaths:(NSArray *)indexPaths - (void)rangeController:(ASRangeController *)rangeController didInsertNodesAtIndexPaths:(NSArray *)indexPaths withAnimationOption:(ASDataControllerAnimationOptions)animationOption
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
[UIView performWithoutAnimation:^{ [UIView performWithoutAnimation:^{
@ -375,7 +377,7 @@ static BOOL _isInterceptedSelector(SEL sel)
}]; }];
} }
- (void)rangeController:(ASRangeController *)rangeController didDeleteNodesAtIndexPaths:(NSArray *)indexPaths - (void)rangeController:(ASRangeController *)rangeController didDeleteNodesAtIndexPaths:(NSArray *)indexPaths withAnimationOption:(ASDataControllerAnimationOptions)animationOption
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
[UIView performWithoutAnimation:^{ [UIView performWithoutAnimation:^{
@ -383,7 +385,7 @@ static BOOL _isInterceptedSelector(SEL sel)
}]; }];
} }
- (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet - (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOption:(ASDataControllerAnimationOptions)animationOption
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
[UIView performWithoutAnimation:^{ [UIView performWithoutAnimation:^{
@ -391,7 +393,7 @@ static BOOL _isInterceptedSelector(SEL sel)
}]; }];
} }
- (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet - (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOption:(ASDataControllerAnimationOptions)animationOption
{ {
ASDisplayNodeAssertMainThread(); ASDisplayNodeAssertMainThread();
[UIView performWithoutAnimation:^{ [UIView performWithoutAnimation:^{