mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-23 01:08:27 +00:00
disables prefetchEnabled by default
Summary: Disables `prefetchEnabled` by default on `IGListCollectionView` (#318). - [x] All tests pass. Demo project builds and runs. - [x] I added tests, an experiment, or detailed why my change isn't tested. - [x] I have reviewed the [contributing guide](https://github.com/Instagram/IGListKit/blob/master/.github/CONTRIBUTING.md) Closes https://github.com/Instagram/IGListKit/pull/323 Differential Revision: D4319761 Pulled By: rnystrom fbshipit-source-id: a3ea4c3d1d1f3123a60c8168fb333e73ab93cb1e
This commit is contained in:
parent
626d26839b
commit
fb9d8cea8e
3 changed files with 34 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
|
|||
|
||||
This release closes the [2.1.0 milestone](https://github.com/Instagram/IGListKit/milestone/2).
|
||||
|
||||
### Enhancements
|
||||
- Disables `prefetchEnabled` by default on `IGListCollectionView`. [Sven Bacia (#323)](https://github.com/Instagram/IGListKit/pull/323)
|
||||
|
||||
2.0.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,24 @@
|
|||
self.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
if ([self respondsToSelector:@selector(setPrefetchingEnabled:)]) {
|
||||
self.prefetchingEnabled = NO;
|
||||
}
|
||||
|
||||
self.alwaysBounceVertical = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
||||
if (self = [super initWithCoder:aDecoder]) {
|
||||
if ([self respondsToSelector:@selector(setPrefetchingEnabled:)]) {
|
||||
self.prefetchingEnabled = NO;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
/**
|
||||
UICollectionView will sometimes lay its cells out with an animation. This is especially noticeable on older devices
|
||||
|
|
|
|||
|
|
@ -50,6 +50,24 @@ static const CGRect kIGListCollectionViewTestFrame = (CGRect){{0.0, 0.0}, {100.0
|
|||
IGListCollectionView *collectionView = [[IGListCollectionView alloc] initWithFrame: kIGListCollectionViewTestFrame collectionViewLayout:[UICollectionViewFlowLayout new]];
|
||||
|
||||
XCTAssertTrue(collectionView.alwaysBounceVertical);
|
||||
|
||||
if ([collectionView respondsToSelector:@selector(isPrefetchingEnabled)]) {
|
||||
XCTAssertFalse(collectionView.isPrefetchingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
-(void)test_thatStoryboardIGListCollectionViewHasCorrectDefaults {
|
||||
UIWindow *window = [[UIWindow alloc] initWithFrame:kIGListCollectionViewTestFrame];
|
||||
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IGTestStoryboard" bundle:[NSBundle bundleForClass:self.class]];
|
||||
IGTestStoryboardViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"testVC"];
|
||||
[window addSubview:viewController.view];
|
||||
[viewController performSelectorOnMainThread:@selector(loadView) withObject:nil waitUntilDone:YES];
|
||||
|
||||
XCTAssertFalse(viewController.collectionView.alwaysBounceVertical);
|
||||
|
||||
if ([UICollectionView instancesRespondToSelector:@selector(isPrefetchingEnabled)]) {
|
||||
XCTAssertFalse(viewController.collectionView.isPrefetchingEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
-(void)test_whenUsingUIAppearance_thatStoryboardIGListCollectionViewUsesAppearanceBackgroundColor {
|
||||
|
|
|
|||
Loading…
Reference in a new issue