小说绘上架版本
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// TFRewardRecordViewCell.h
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/21.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class TFRewardRecordListModel;
|
||||
|
||||
@interface TFRewardRecordViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic ,strong) TFRewardRecordListModel *recordModel;
|
||||
|
||||
- (void)setSplitLineHidden:(BOOL)hidden;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// TFRewardRecordViewCell.m
|
||||
// TFReader
|
||||
//
|
||||
// Created by 谢腾飞 on 2020/12/21.
|
||||
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TFRewardRecordViewCell.h"
|
||||
#import "TFRewardRecordModel.h"
|
||||
#import "NSObject+Observer.h"
|
||||
|
||||
@interface TFRewardRecordViewCell ()
|
||||
{
|
||||
UIView *_splitLine;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation TFRewardRecordViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self createSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)createSubviews
|
||||
{
|
||||
UILabel *nameLabel = [[UILabel alloc] init];
|
||||
nameLabel.textColor = kBlackColor;
|
||||
nameLabel.font = kFont14;
|
||||
[self.contentView addSubview:nameLabel];
|
||||
[nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.contentView).offset(kMargin);
|
||||
make.left.equalTo(self.contentView).offset(kMoreHalfMargin);
|
||||
}];
|
||||
|
||||
UILabel *descLabel = [[UILabel alloc] init];
|
||||
descLabel.textColor = kGrayTextColor;
|
||||
descLabel.font = kFont13;
|
||||
[self.contentView addSubview:descLabel];
|
||||
[descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(nameLabel.mas_bottom).offset(kHalfMargin);
|
||||
make.left.equalTo(nameLabel);
|
||||
}];
|
||||
|
||||
UILabel *timeLabel = [[UILabel alloc] init];
|
||||
timeLabel.textColor = kGrayTextColor;
|
||||
timeLabel.font = kFont13;
|
||||
[self.contentView addSubview:timeLabel];
|
||||
[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(descLabel.mas_bottom).offset(kHalfMargin);
|
||||
make.left.equalTo(nameLabel);
|
||||
}];
|
||||
|
||||
_splitLine = [[UIView alloc] init];
|
||||
_splitLine.backgroundColor = kGrayLineColor;
|
||||
[self.contentView addSubview:_splitLine];
|
||||
[_splitLine mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kCellLineHeight);
|
||||
make.bottom.equalTo(self.contentView);
|
||||
make.left.equalTo(self.contentView).offset(kMoreHalfMargin);
|
||||
make.right.equalTo(self.contentView).offset(-kMoreHalfMargin);
|
||||
make.top.equalTo(timeLabel.mas_bottom).offset(kHalfMargin).priorityLow();
|
||||
}];
|
||||
|
||||
[self addObserver:KEY_PATH(self, recordModel) complete:^(id _Nonnull obj, id _Nullable oldVal, TFRewardRecordListModel * _Nullable newVal) {
|
||||
nameLabel.text = newVal.title ? : @"";
|
||||
timeLabel.text = newVal.time ? : @"";
|
||||
descLabel.text = newVal.desc ? : @"";
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setSplitLineHidden:(BOOL)hidden
|
||||
{
|
||||
_splitLine.hidden = hidden;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user