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.

51 lines
1.5 KiB

//
// TFBookStoreNovelStyleOneCell.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/16.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFBookStoreNovelStyleOneCell.h"
#import "TFBookStoreNovelVerticalCell.h"
@implementation TFBookStoreNovelStyleOneCell
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
{
if (!self.labelModel.list) {
return 3;
}
return self.labelModel.list.count <= 3 ? self.labelModel.list.count : 3;
}
- (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;
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
TFProductionModel *labelListModel = [self.labelModel.list objectOrNilAtIndex:indexPath.row];
if (self.cellDidSelectItemBlock) {
self.cellDidSelectItemBlock(labelListModel.production_id);
}
}
@end