diff --git a/Source/IGListKit/IGListBindingSingleSectionController.m b/Source/IGListKit/IGListBindingSingleSectionController.m index f57bdc55..82f76908 100644 --- a/Source/IGListKit/IGListBindingSingleSectionController.m +++ b/Source/IGListKit/IGListBindingSingleSectionController.m @@ -8,8 +8,9 @@ #import "IGListBindingSingleSectionController.h" #import +#import "IGListSectionControllerInternal.h" -@interface IGListBindingSingleSectionController () +@interface IGListBindingSingleSectionController () @end @@ -18,13 +19,6 @@ __weak UICollectionViewCell *_displayingCell; } -- (instancetype)init { - if (self = [super init]) { - self.displayDelegate = self; - } - return self; -} - - (void)didSelectItemWithCell:(UICollectionViewCell *)cell { // no-op } @@ -55,28 +49,6 @@ return CGSizeZero; } -#pragma mark - IGListDisplayDelegate - -- (void)listAdapter:(nonnull IGListAdapter *)listAdapter willDisplaySectionController:(nonnull IGListSectionController *)sectionController { - // no-op -} - -- (void)listAdapter:(nonnull IGListAdapter *)listAdapter didEndDisplayingSectionController:(nonnull IGListSectionController *)sectionController { - // no-op -} - -- (void)listAdapter:(nonnull IGListAdapter *)listAdapter willDisplaySectionController:(nonnull IGListSectionController *)sectionController cell:(nonnull UICollectionViewCell *)cell atIndex:(NSInteger)index { - IGParameterAssert(index == 0); - _displayingCell = cell; -} - -- (void)listAdapter:(nonnull IGListAdapter *)listAdapter didEndDisplayingSectionController:(nonnull IGListSectionController *)sectionController cell:(nonnull UICollectionViewCell *)cell atIndex:(NSInteger)index { - IGParameterAssert(index == 0); - if (cell == _displayingCell) { - _displayingCell = nil; - } -} - #pragma mark - IGListSectionController Overrides - (NSInteger)numberOfItems { @@ -130,4 +102,18 @@ [self didUnhighlightItemWithCell:cell]; } +- (void)willDisplayCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter { + IGParameterAssert(index == 0); + _displayingCell = cell; + [super willDisplayCell:cell atIndex:index listAdapter:listAdapter]; +} + +- (void)didEndDisplayingCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index listAdapter:(IGListAdapter *)listAdapter { + IGParameterAssert(index == 0); + if (cell == _displayingCell) { + _displayingCell = nil; + } + [super didEndDisplayingCell:cell atIndex:index listAdapter:listAdapter]; +} + @end