2016-09-07 22:37:59 +00:00
|
|
|
/**
|
2018-11-01 17:56:41 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2016-09-07 22:37:59 +00:00
|
|
|
* 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"
|
|
|
|
|
|
2016-11-05 23:27:32 +00:00
|
|
|
#import "IGTestNibSupplementaryView.h"
|
|
|
|
|
|
2016-09-07 22:37:59 +00:00
|
|
|
@implementation IGTestSupplementarySource
|
|
|
|
|
|
2017-03-29 21:58:43 +00:00
|
|
|
- (instancetype)init {
|
|
|
|
|
if (self = [super init]) {
|
|
|
|
|
_size = CGSizeMake(100, 10);
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-07 22:37:59 +00:00
|
|
|
#pragma mark - IGListSupplementaryViewSource
|
|
|
|
|
|
|
|
|
|
- (UICollectionReusableView *)viewForSupplementaryElementOfKind:(NSString *)elementKind
|
|
|
|
|
atIndex:(NSInteger)index {
|
2016-11-05 23:27:32 +00:00
|
|
|
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];
|
|
|
|
|
}
|
2016-09-07 22:37:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (CGSize)sizeForSupplementaryViewOfKind:(NSString *)elementKind atIndex:(NSInteger)index {
|
2017-03-29 21:58:43 +00:00
|
|
|
return self.size;
|
2016-09-07 22:37:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|