You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
4 years ago
|
//
|
||
|
// TFBookStoreNovelStyleTwoCell.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/16.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFBookStoreNovelStyleTwoCell.h"
|
||
|
#import "TFBookStoreNovelVerticalCell.h"
|
||
|
|
||
|
@implementation TFBookStoreNovelStyleTwoCell
|
||
|
static NSString *cellID = @"TFBookStoreNovelVerticalCell";
|
||
|
|
||
|
- (void)createSubviews
|
||
|
{
|
||
|
[super createSubviews];
|
||
|
|
||
|
self.collectionView.delegate = self;
|
||
|
self.collectionView.dataSource = self;
|
||
|
|
||
|
[self.collectionView registerClass:[TFBookStoreNovelVerticalCell class] forCellWithReuseIdentifier:cellID];
|
||
|
}
|
||
|
|
||
|
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
|
||
|
{
|
||
|
return self.labelModel.list.count <= 6 ? self.labelModel.list.count : 6;
|
||
|
}
|
||
|
|
||
|
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
|
||
|
{
|
||
|
TFBookStoreNovelVerticalCell __weak *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
|
||
|
|
||
|
cell.labelListModel = [self.labelModel.list objectOrNilAtIndex:indexPath.row];
|
||
|
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
|
||
|
{
|
||
|
return kHalfMargin;
|
||
|
}
|
||
|
|
||
|
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
|
||
|
{
|
||
|
TFProductionModel *production = [self.labelModel.list objectOrNilAtIndex:indexPath.row];
|
||
|
|
||
|
if (self.cellDidSelectItemBlock) {
|
||
|
self.cellDidSelectItemBlock(production.production_id);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@end
|