Skip to content

Commit

Permalink
Merge pull request #9 from grigaci/feature/collectionDataSourceWithNibs
Browse files Browse the repository at this point in the history
accept nibs in BIDatasourceCollectionView
  • Loading branch information
grigaci committed Nov 25, 2015
2 parents 6f92873 + 39059d4 commit daf0c41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef void(^BIDatasourceCollectionViewConfigureCell)(id __nonnull cell, NSInde
@property (nonatomic, readonly, strong, nonnull) UICollectionView *collectionView;
@property (nonatomic, copy, nullable) NSString *cellIdentifier;
@property (nonatomic, strong, nullable) Class cellClass;
@property (nonatomic, strong, nullable) UINib *cellNib;
@property (nonatomic, copy, nullable) BIDatasourceCollectionViewConfigureCell configureCellBlock;

- (void)configureCell:(nonnull UICollectionViewCell *)cell atIndexPath:(nonnull NSIndexPath *)indexPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ - (void)load {
NSParameterAssert(self.cellIdentifier.length);
NSParameterAssert([self.cellClass isSubclassOfClass:[UICollectionViewCell class]]);

[self.collectionView registerClass:self.cellClass forCellWithReuseIdentifier:self.cellIdentifier];
if (self.cellNib) {
[self.collectionView registerNib:self.cellNib forCellWithReuseIdentifier:self.cellIdentifier];
} else if (self.cellClass) {
[self.collectionView registerClass:self.cellClass forCellWithReuseIdentifier:self.cellIdentifier];
}
}

- (void)configureCell:(UICollectionViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
Expand Down

0 comments on commit daf0c41

Please sign in to comment.