//
|
// PBRightTableViewCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2020/7/29.
|
// Copyright © 2020 ProBIM. All rights reserved.
|
//
|
|
#import "PBRightTableViewCell.h"
|
#import "PBModelsModel.h"
|
@interface PBRightTableViewCell()
|
@property (nonatomic, weak) UIImageView *imageV;
|
@property (nonatomic, weak) UILabel *nameL;
|
@property (nonatomic, weak) UILabel *timeL;
|
@end
|
@implementation PBRightTableViewCell
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
self.contentView.backgroundColor = PBColor(245, 244, 247);
|
UIView *bgV = [[UIView alloc] init];
|
bgV.backgroundColor = [UIColor whiteColor];
|
[self.contentView addSubview:bgV];
|
[bgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.contentView).offset(10);
|
make.left.equalTo(self.contentView).offset(10);
|
make.right.equalTo(self.contentView).offset(-10);
|
make.height.equalTo(@90);
|
make.bottom.equalTo(self.contentView);
|
}];
|
[bgV circleViewWithRadius:6];
|
|
UIImageView *imageV = [[UIImageView alloc] init];
|
[self.contentView addSubview:imageV];
|
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(bgV).offset(10);
|
make.left.equalTo(bgV).offset(10);
|
make.bottom.equalTo(bgV).offset(-10);
|
make.width.equalTo(@70);
|
}];
|
[imageV circleViewWithRadius:6];
|
|
UILabel *nameL = [UILabel z_labelWithText:@"" Color:PBColor(40, 58, 79) isBold:YES Font:14];
|
nameL.numberOfLines = 2;
|
[self.contentView addSubview:nameL];
|
[nameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(bgV).offset(10);
|
make.left.equalTo(imageV.mas_right).offset(10);
|
make.right.equalTo(bgV).offset(-10);
|
}];
|
|
UILabel *timeL = [UILabel z_labelWithText:@"" Color:PBColor(166, 174, 182) isBold:YES Font:13];
|
[self.contentView addSubview:timeL];
|
[timeL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.bottom.equalTo(imageV);
|
make.left.right.equalTo(nameL);
|
make.height.equalTo(@16);
|
}];
|
self.imageV = imageV;
|
self.nameL = nameL;
|
self.timeL = timeL;
|
}
|
|
- (void)setModelsModel:(PBModelsModel *)modelsModel {
|
_modelsModel = modelsModel;
|
if([modelsModel.Thumbnail isEqualToString:@""]) {
|
self.imageV.image = [UIImage imageNamed:@"logo_unknown"];
|
}else {
|
self.imageV.image = [NSString imageDecoding:modelsModel.Thumbnail];
|
}
|
self.nameL.text = modelsModel.Name;
|
NSString *timeStr = [modelsModel.CreateTime stringByReplacingOccurrencesOfString:@"T" withString:@" "];
|
NSRange range = [timeStr rangeOfString:@":"];
|
timeStr = [timeStr substringToIndex:range.location + 3];
|
self.timeL.text = timeStr;
|
|
}
|
|
- (void)awakeFromNib {
|
[super awakeFromNib];
|
// Initialization code
|
}
|
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
[super setSelected:selected animated:animated];
|
|
// Configure the view for the selected state
|
}
|
|
@end
|