This repository was archived by the owner on Feb 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Expand file tree Collapse file tree 4 files changed +56
-3
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,17 @@ NS_ASSUME_NONNULL_BEGIN
376376@optional
377377
378378- (void )collectionView : (ASCollectionView *)collectionView willDisplayNodeForItemAtIndexPath : (NSIndexPath *)indexPath ;
379- - (void )collectionView : (ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath : (NSIndexPath *)indexPath ;
379+
380+ /* *
381+ * Informs the delegate that the collection view did remove the provided node from the view hierarchy.
382+ * This may be caused by the node scrolling out of view, or by deleting the item
383+ * or its containing section with @c deleteItemsAtIndexPaths: or @c deleteSections: .
384+ *
385+ * @param collectionView The sender.
386+ * @param node The node which was removed from the view hierarchy.
387+ * @param indexPath The index path at which the node was located before it was removed.
388+ */
389+ - (void )collectionView : (ASCollectionView *)collectionView didEndDisplayingNode : (ASCellNode *)node forItemAtIndexPath : (NSIndexPath *)indexPath ;
380390
381391/* *
382392 * Receive a message that the collectionView is near the end of its data set and more data should be fetched if
@@ -406,6 +416,14 @@ NS_ASSUME_NONNULL_BEGIN
406416 */
407417- (BOOL )shouldBatchFetchForCollectionView : (ASCollectionView *)collectionView ;
408418
419+ /* *
420+ * Informs the delegate that the collection view did remove the node which was previously
421+ * at the given index path from the view hierarchy.
422+ *
423+ * This method is deprecated. Use @c collectionView:didEndDisplayingNode:forItemAtIndexPath: instead.
424+ */
425+ - (void )collectionView : (ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath : (NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
426+
409427@end
410428
411429/* *
Original file line number Diff line number Diff line change @@ -570,10 +570,18 @@ - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICol
570570- (void )collectionView : (UICollectionView *)collectionView didEndDisplayingCell : (UICollectionViewCell *)cell forItemAtIndexPath : (NSIndexPath *)indexPath
571571{
572572 [_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection: self .scrollDirection];
573-
573+
574+ if ([_asyncDelegate respondsToSelector: @selector (collectionView:didEndDisplayingNode:forItemAtIndexPath: )]) {
575+ ASCellNode *node = ((_ASCollectionViewCell *)cell).node ;
576+ ASDisplayNodeAssertNotNil (node, @" Expected node associated with removed cell not to be nil." );
577+ [_asyncDelegate collectionView: self didEndDisplayingNode: node forItemAtIndexPath: indexPath];
578+ }
579+ #pragma clang diagnostic push
580+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
574581 if ([_asyncDelegate respondsToSelector: @selector (collectionView:didEndDisplayingNodeForItemAtIndexPath: )]) {
575582 [_asyncDelegate collectionView: self didEndDisplayingNodeForItemAtIndexPath: indexPath];
576583 }
584+ #pragma clang diagnostic pop
577585}
578586
579587- (void )layoutSubviews
Original file line number Diff line number Diff line change @@ -336,7 +336,17 @@ NS_ASSUME_NONNULL_BEGIN
336336@optional
337337
338338- (void )tableView : (ASTableView *)tableView willDisplayNodeForRowAtIndexPath : (NSIndexPath *)indexPath ;
339- - (void )tableView : (ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath : (NSIndexPath *)indexPath ;
339+
340+ /* *
341+ * Informs the delegate that the table view did remove the provided node from the view hierarchy.
342+ * This may be caused by the node scrolling out of view, or by deleting the row
343+ * or its containing section with @c deleteRowsAtIndexPaths:withRowAnimation: or @c deleteSections:withRowAnimation: .
344+ *
345+ * @param tableView The sender.
346+ * @param node The node which was removed from the view hierarchy.
347+ * @param indexPath The index path at which the node was located before the removal.
348+ */
349+ - (void )tableView : (ASTableView *)tableView didEndDisplayingNode : (ASCellNode *)node forRowAtIndexPath : (NSIndexPath *)indexPath ;
340350
341351/* *
342352 * Receive a message that the tableView is near the end of its data set and more data should be fetched if necessary.
@@ -365,6 +375,14 @@ NS_ASSUME_NONNULL_BEGIN
365375 */
366376- (BOOL )shouldBatchFetchForTableView : (ASTableView *)tableView ;
367377
378+ /* *
379+ * Informs the delegate that the table view did remove the node which was previously
380+ * at the given index path from the view hierarchy.
381+ *
382+ * This method is deprecated. Use @c tableView:didEndDisplayingNode:forRowAtIndexPath: instead.
383+ */
384+ - (void )tableView : (ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath : (NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED;
385+
368386@end
369387
370388@protocol ASTableViewDelegate <ASTableDelegate>
Original file line number Diff line number Diff line change @@ -598,9 +598,18 @@ - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell
598598
599599 [_rangeController visibleNodeIndexPathsDidChangeWithScrollDirection: self .scrollDirection];
600600
601+ if ([_asyncDelegate respondsToSelector: @selector (tableView:didEndDisplayingNode:forRowAtIndexPath: )]) {
602+ ASCellNode *node = ((_ASTableViewCell *)cell).node ;
603+ ASDisplayNodeAssertNotNil (node, @" Expected node associated with removed cell not to be nil." );
604+ [_asyncDelegate tableView: self didEndDisplayingNode: node forRowAtIndexPath: indexPath];
605+ }
606+
607+ #pragma clang diagnostic push
608+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
601609 if ([_asyncDelegate respondsToSelector: @selector (tableView:didEndDisplayingNodeForRowAtIndexPath: )]) {
602610 [_asyncDelegate tableView: self didEndDisplayingNodeForRowAtIndexPath: indexPath];
603611 }
612+ #pragma clang diagnostic pop
604613}
605614
606615
You can’t perform that action at this time.
0 commit comments