110 lines
3.4 KiB
Objective-C
110 lines
3.4 KiB
Objective-C
//
|
|
// TFBookStoreNovelBasicItemCell.m
|
|
// TFReader
|
|
//
|
|
// Created by 谢腾飞 on 2020/12/16.
|
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
|
//
|
|
|
|
#import "TFBookStoreNovelBasicItemCell.h"
|
|
|
|
@implementation TFBookStoreNovelBasicItemCell
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
if (self = [super initWithFrame:frame]) {
|
|
|
|
self.backgroundColor = kWhiteColor;
|
|
[self createSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)createSubviews
|
|
{
|
|
// 封面
|
|
self.coverView = [[TFProductionCoverView alloc] initWithProductionType:TFProductionTypeNovel coverDirection:TFProductionCoverDirectionVertical];
|
|
self.coverView.userInteractionEnabled = YES;
|
|
[self addSubview:self.coverView];
|
|
|
|
[self.coverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(0);
|
|
make.top.mas_equalTo(kHalfMargin);
|
|
make.width.mas_equalTo(BOOK_WIDTH - 10);
|
|
make.height.mas_equalTo(kGeometricHeight(BOOK_WIDTH - 10, 3, 4));
|
|
make.bottom.mas_equalTo(self.mas_bottom).priorityLow();
|
|
}];
|
|
|
|
// 书名
|
|
self.titleLabel = [[UILabel alloc] init];
|
|
self.titleLabel.numberOfLines = 1;
|
|
self.titleLabel.backgroundColor = kWhiteColor;
|
|
self.titleLabel.font = kMainFont;
|
|
self.titleLabel.textAlignment = NSTextAlignmentLeft;
|
|
[self addSubview:self.titleLabel];
|
|
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.coverView.mas_right).with.offset(kHalfMargin);
|
|
make.top.mas_equalTo(self.coverView.mas_top);
|
|
make.right.mas_equalTo(self.mas_right);
|
|
make.height.mas_equalTo(BOOK_CELL_TITLE_HEIGHT / 2);
|
|
}];
|
|
|
|
// 子标题
|
|
self.subtitleLabel = [[UILabel alloc] init];
|
|
self.subtitleLabel.textColor = kGrayTextColor;
|
|
self.subtitleLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.subtitleLabel.font = kFont11;
|
|
self.subtitleLabel.numberOfLines = 1;
|
|
self.subtitleLabel.hidden = YES;
|
|
[self addSubview:self.subtitleLabel];
|
|
|
|
[self.subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(self.titleLabel.mas_left);
|
|
make.top.mas_equalTo(self.titleLabel.mas_bottom);
|
|
make.right.mas_equalTo(self.titleLabel.mas_right);
|
|
make.height.mas_equalTo(self.titleLabel.mas_height);
|
|
make.bottom.mas_equalTo(self.mas_bottom).priorityLow();
|
|
}];
|
|
|
|
// 横线
|
|
self.lineView = [[UIView alloc] init];
|
|
self.lineView.hidden = YES;
|
|
self.lineView.backgroundColor = kGrayLineColor;
|
|
[self addSubview:self.lineView];
|
|
|
|
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.mas_equalTo(kMargin);
|
|
make.top.mas_equalTo(self.mas_bottom).with.offset(-kCellLineHeight);
|
|
make.right.mas_equalTo(self.mas_right).with.offset(kHalfMargin);
|
|
make.height.mas_equalTo(kCellLineHeight);
|
|
}];
|
|
}
|
|
|
|
- (void)setLabelListModel:(TFProductionModel *)labelListModel
|
|
{
|
|
_labelListModel = labelListModel;
|
|
|
|
if (!labelListModel) {
|
|
return;
|
|
}
|
|
|
|
self.coverView.coverImageUrl = labelListModel.cover;
|
|
self.coverView.productionType = labelListModel.productionType;
|
|
self.titleLabel.text = labelListModel.name ? : @"";
|
|
}
|
|
|
|
- (void)setHiddenEndLine:(BOOL)hiddenEndLine
|
|
{
|
|
_hiddenEndLine = hiddenEndLine;
|
|
|
|
self.lineView.hidden = hiddenEndLine;
|
|
}
|
|
|
|
- (void)setCellIndexPath:(NSIndexPath *)cellIndexPath
|
|
{
|
|
_cellIndexPath = cellIndexPath;
|
|
}
|
|
|
|
@end
|