Remove iOS 7 UICollectionView delegate API support

Summary: Don't need support for iOS 7 anymore, save some cycles on layout.

Reviewed By: ocrickard

Differential Revision: D4098229

fbshipit-source-id: eeaaf875acda1229f9622f11acc7c77ccad75cf0
This commit is contained in:
Ryan Nystrom 2016-10-29 14:58:18 -07:00 committed by Facebook Github Bot
parent e4a47193c1
commit 9e8ad9626a

View file

@ -9,21 +9,11 @@
#import "IGListCollectionView.h"
@interface IGListCollectionView ()
@property (nonatomic, assign, readonly) BOOL requiresManualWillDisplay;
@property (nonatomic, strong) NSSet *ig_visibleIndexPaths;
@end
@implementation IGListCollectionView
- (void)commonInit {
self.backgroundColor = [UIColor whiteColor];
self.alwaysBounceVertical = YES;
// iOS 6 and 7 do not support -collectionView:willDisplayCell:forItemAtIndexPath: so we do it ourselves
_requiresManualWillDisplay = [[[UIDevice currentDevice] systemVersion] floatValue] < 8.0;
}
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
@ -49,17 +39,6 @@
[UIView performWithoutAnimation:^{
[super layoutSubviews];
}];
if (self.requiresManualWillDisplay && [self.delegate respondsToSelector:@selector(collectionView:willDisplayCell:forItemAtIndexPath:)]) {
NSArray *indexPaths = [self indexPathsForVisibleItems];
for (NSIndexPath *path in indexPaths) {
if (![self.ig_visibleIndexPaths containsObject:path]) {
UICollectionViewCell *cell = [self cellForItemAtIndexPath:path];
[self.delegate collectionView:self willDisplayCell:cell forItemAtIndexPath:path];
}
}
self.ig_visibleIndexPaths = [NSSet setWithArray:indexPaths];
}
}
@end