mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-14 21:08:48 +00:00
Summary: If a negative height/width comes down, cap it to `0.0`. Issue fixed: #566 Also fixes t16455632 internally. - [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 added an entry to the `CHANGELOG.md` for any breaking changes, enhancements, or bug fixes. Closes https://github.com/Instagram/IGListKit/pull/583 Differential Revision: D4797520 Pulled By: jessesquires fbshipit-source-id: 3eeec5244a445bb451460286b4f006ca0d9c67d1
49 lines
1.2 KiB
Objective-C
49 lines
1.2 KiB
Objective-C
/**
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import "IGListTestSection.h"
|
|
|
|
@implementation IGListTestSection
|
|
|
|
- (instancetype)init {
|
|
if (self = [super init]) {
|
|
_size = CGSizeMake(100, 10);
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (NSArray <Class> *)cellClasses {
|
|
return @[UICollectionViewCell.class];
|
|
}
|
|
|
|
- (NSInteger)numberOfItems {
|
|
return self.items;
|
|
}
|
|
|
|
- (CGSize)sizeForItemAtIndex:(NSInteger)index {
|
|
return self.size;
|
|
}
|
|
|
|
- (UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index {
|
|
return [self.collectionContext dequeueReusableCellOfClass:UICollectionViewCell.class
|
|
forSectionController:self
|
|
atIndex:index];
|
|
}
|
|
|
|
- (void)didUpdateToObject:(id)object {
|
|
if ([object isKindOfClass:[NSNumber class]]) {
|
|
self.items = [object integerValue];
|
|
}
|
|
}
|
|
|
|
- (void)didSelectItemAtIndex:(NSInteger)index {
|
|
self.wasSelected = YES;
|
|
}
|
|
|
|
@end
|