|
12 | 12 | #import "ASCollectionViewLayoutController.h" |
13 | 13 | #import "ASRangeController.h" |
14 | 14 | #import "ASCollectionDataController.h" |
15 | | -#import "ASDisplayNodeInternal.h" |
16 | 15 | #import "ASBatchFetching.h" |
17 | 16 | #import "UICollectionViewLayout+ASConvenience.h" |
18 | 17 | #import "ASInternalHelpers.h" |
@@ -131,7 +130,7 @@ - (void)setHighlighted:(BOOL)highlighted |
131 | 130 | #pragma mark - |
132 | 131 | #pragma mark ASCollectionView. |
133 | 132 |
|
134 | | -@interface ASCollectionView () <ASRangeControllerDelegate, ASDataControllerSource> { |
| 133 | +@interface ASCollectionView () <ASRangeControllerDelegate, ASDataControllerSource, ASCellNodeDelegate> { |
135 | 134 | _ASCollectionViewProxy *_proxyDataSource; |
136 | 135 | _ASCollectionViewProxy *_proxyDelegate; |
137 | 136 |
|
@@ -269,7 +268,7 @@ - (ASCollectionViewFlowLayoutInspector *)flowLayoutInspector |
269 | 268 | - (void)reloadDataWithCompletion:(void (^)())completion |
270 | 269 | { |
271 | 270 | ASDisplayNodeAssert(self.asyncDelegate, @"ASCollectionView's asyncDelegate property must be set."); |
272 | | - ASDisplayNodePerformBlockOnMainThread(^{ |
| 271 | + ASPerformBlockOnMainThread(^{ |
273 | 272 | _superIsPendingDataLoad = YES; |
274 | 273 | [super reloadData]; |
275 | 274 | }); |
@@ -458,14 +457,6 @@ - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths |
458 | 457 | [_dataController reloadRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone]; |
459 | 458 | } |
460 | 459 |
|
461 | | -- (void)relayoutItemAtIndexPath:(NSIndexPath *)indexPath |
462 | | -{ |
463 | | - ASDisplayNodeAssertMainThread(); |
464 | | - ASCellNode *node = [self nodeForItemAtIndexPath:indexPath]; |
465 | | - [node setNeedsLayout]; |
466 | | - [super reloadItemsAtIndexPaths:@[indexPath]]; |
467 | | -} |
468 | | - |
469 | 460 | - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath |
470 | 461 | { |
471 | 462 | ASDisplayNodeAssertMainThread(); |
@@ -664,6 +655,7 @@ - (ASCellNode *)dataController:(ASDataController *)dataController nodeAtIndexPat |
664 | 655 | { |
665 | 656 | ASCellNode *node = [_asyncDataSource collectionView:self nodeForItemAtIndexPath:indexPath]; |
666 | 657 | ASDisplayNodeAssert([node isKindOfClass:ASCellNode.class], @"invalid node class, expected ASCellNode"); |
| 658 | + node.delegate = self; |
667 | 659 | return node; |
668 | 660 | } |
669 | 661 |
|
@@ -895,4 +887,15 @@ - (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAt |
895 | 887 | } |
896 | 888 | } |
897 | 889 |
|
| 890 | +#pragma mark - ASCellNodeDelegate |
| 891 | + |
| 892 | +- (void)node:(ASCellNode *)node didRelayoutWithSuggestedAnimation:(ASCellNodeAnimation)animation |
| 893 | +{ |
| 894 | + ASDisplayNodeAssertMainThread(); |
| 895 | + NSIndexPath *indexPath = [self indexPathForNode:node]; |
| 896 | + if (indexPath != nil) { |
| 897 | + [super reloadItemsAtIndexPaths:@[indexPath]]; |
| 898 | + } |
| 899 | +} |
| 900 | + |
898 | 901 | @end |
0 commit comments