mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 01:08:27 +00:00
Add fullyVisibleCellsForSectionController to IGListCollectionContext [IGListKit]
Reviewed By: chritto Differential Revision: D20261859 fbshipit-source-id: 919132f935462c2a57270f0afaba511adc936995
This commit is contained in:
parent
c321831b80
commit
68e58bf60e
2 changed files with 25 additions and 0 deletions
|
|
@ -927,6 +927,22 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewCell *> *)fullyVisibleCellsForSectionController:(IGListSectionController *)sectionController {
|
||||
NSMutableArray *cells = [NSMutableArray new];
|
||||
UICollectionView *collectionView = self.collectionView;
|
||||
NSArray *visibleCells = [collectionView visibleCells];
|
||||
const NSInteger section = [self sectionForSectionController:sectionController];
|
||||
for (UICollectionViewCell *cell in visibleCells) {
|
||||
if ([collectionView indexPathForCell:cell].section == section) {
|
||||
const CGRect cellRect = [cell convertRect:cell.bounds toView:collectionView];
|
||||
if (CGRectContainsRect(UIEdgeInsetsInsetRect(collectionView.bounds, collectionView.contentInset), cellRect)) {
|
||||
[cells addObject:cell];
|
||||
}
|
||||
}
|
||||
}
|
||||
return cells;
|
||||
}
|
||||
|
||||
- (NSArray<UICollectionViewCell *> *)visibleCellsForSectionController:(IGListSectionController *)sectionController {
|
||||
NSMutableArray *cells = [NSMutableArray new];
|
||||
UICollectionView *collectionView = self.collectionView;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,15 @@ NS_SWIFT_NAME(ListCollectionContext)
|
|||
- (nullable __kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index
|
||||
sectionController:(IGListSectionController *)sectionController;
|
||||
|
||||
/**
|
||||
Returns the fully visible cells for the given section controller.
|
||||
|
||||
@param sectionController The section controller requesting this information.
|
||||
|
||||
@return An array of fully visible cells, or an empty array if none are found.
|
||||
*/
|
||||
- (NSArray<UICollectionViewCell *> *)fullyVisibleCellsForSectionController:(IGListSectionController *)sectionController;
|
||||
|
||||
/**
|
||||
Returns the visible cells for the given section controller.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue