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
47 lines
2 KiB
Objective-C
47 lines
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 "IGTestSupplementarySource.h"
|
|
|
|
#import "IGTestNibSupplementaryView.h"
|
|
|
|
@implementation IGTestSupplementarySource
|
|
|
|
- (instancetype)init {
|
|
if (self = [super init]) {
|
|
_size = CGSizeMake(100, 10);
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - IGListSupplementaryViewSource
|
|
|
|
- (UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind
|
|
atIndex:(NSInteger)index {
|
|
if (self.dequeueFromNib) {
|
|
IGTestNibSupplementaryView *view = [self.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind
|
|
forSectionController:self.sectionController
|
|
nibName:@"IGTestNibSupplementaryView"
|
|
bundle:[NSBundle bundleForClass:self.class]
|
|
atIndex:index];
|
|
view.label.text = @"Foo bar baz";
|
|
return view;
|
|
} else {
|
|
return [self.collectionContext dequeueReusableSupplementaryViewOfKind:elementKind
|
|
forSectionController:self.sectionController
|
|
class:[UICollectionReusableView class]
|
|
atIndex:index];
|
|
}
|
|
}
|
|
|
|
- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndex:(NSInteger)index {
|
|
return self.size;
|
|
}
|
|
|
|
@end
|