diff --git a/Source/IGListKit/IGListSectionController.m b/Source/IGListKit/IGListSectionController.m index d614523d..fdb9b7bd 100644 --- a/Source/IGListKit/IGListSectionController.m +++ b/Source/IGListKit/IGListSectionController.m @@ -100,4 +100,20 @@ void IGListSectionControllerPopThread(void) { IGFailAssert(@"Section controller %@ must override %s if interactive reordering is enabled.", self, __PRETTY_FUNCTION__); } +- (void)willDisplayCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter { + [_displayDelegate listAdapter:listAdapter willDisplaySectionController:self cell:cell atIndex:index]; +} + +- (void)didEndDisplayingCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter { + [_displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:self cell:cell atIndex:index]; +} + +- (void)willDisplaySectionControllerWithListAdapter:(IGListAdapter *)listAdapter { + [_displayDelegate listAdapter:listAdapter willDisplaySectionController:self]; +} + +- (void)didEndDisplayingSectionControllerWithListAdapter:(IGListAdapter *)listAdapter { + [_displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:self]; +} + @end diff --git a/Source/IGListKit/Internal/IGListDisplayHandler.m b/Source/IGListKit/Internal/IGListDisplayHandler.m index 3ca38f7f..cb1efd6f 100644 --- a/Source/IGListKit/Internal/IGListDisplayHandler.m +++ b/Source/IGListKit/Internal/IGListDisplayHandler.m @@ -11,6 +11,7 @@ #import #import #import +#import @interface IGListDisplayHandler () @@ -48,7 +49,7 @@ [self.visibleViewObjectMap setObject:object forKey:view]; NSCountedSet *visibleListSections = self.visibleListSections; if ([visibleListSections countForObject:sectionController] == 0) { - [sectionController.displayDelegate listAdapter:listAdapter willDisplaySectionController:sectionController]; + [sectionController willDisplaySectionControllerWithListAdapter:listAdapter]; [listAdapter.delegate listAdapter:listAdapter willDisplayObject:object atIndex:indexPath.section]; } [visibleListSections addObject:sectionController]; @@ -73,7 +74,7 @@ [visibleSections removeObject:sectionController]; if ([visibleSections countForObject:sectionController] == 0) { - [sectionController.displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:sectionController]; + [sectionController didEndDisplayingSectionControllerWithListAdapter:listAdapter]; [listAdapter.delegate listAdapter:listAdapter didEndDisplayingObject:object atIndex:section]; } } @@ -100,8 +101,7 @@ sectionController:(IGListSectionController *)sectionController object:(id)object indexPath:(NSIndexPath *)indexPath { - id displayDelegate = [sectionController displayDelegate]; - [displayDelegate listAdapter:listAdapter willDisplaySectionController:sectionController cell:cell atIndex:indexPath.item]; + [sectionController willDisplayCell:cell atIndex:indexPath.item listAdapter:listAdapter]; [self _willDisplayReusableView:cell forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath]; } @@ -114,8 +114,7 @@ if (object == nil) { return; } - - [sectionController.displayDelegate listAdapter:listAdapter didEndDisplayingSectionController:sectionController cell:cell atIndex:indexPath.item]; + [sectionController didEndDisplayingCell:cell atIndex:indexPath.item listAdapter:listAdapter]; [self _didEndDisplayingReusableView:cell forListAdapter:listAdapter sectionController:sectionController object:object indexPath:indexPath]; } diff --git a/Source/IGListKit/Internal/IGListSectionControllerInternal.h b/Source/IGListKit/Internal/IGListSectionControllerInternal.h index 75160afe..11c745b3 100644 --- a/Source/IGListKit/Internal/IGListSectionControllerInternal.h +++ b/Source/IGListKit/Internal/IGListSectionControllerInternal.h @@ -28,4 +28,12 @@ FOUNDATION_EXTERN void IGListSectionControllerPopThread(void); */ - (BOOL)canMoveItemAtIndex:(NSInteger)sourceItemIndex toIndex:(NSInteger)destinationItemIndex; +- (void)willDisplayCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter; + +- (void)didEndDisplayingCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter; + +- (void)willDisplaySectionControllerWithListAdapter:(IGListAdapter *)listAdapter; + +- (void)didEndDisplayingSectionControllerWithListAdapter:(IGListAdapter *)listAdapter; + @end