//
|
// PBModelsTableViewCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/7/20.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBModelsTableViewCell.h"
|
#import "PBModelsModel.h"
|
@interface PBModelsTableViewCell()
|
@property (nonatomic, weak) UIImageView *modelImageV;
|
@property (nonatomic, weak) UILabel *modelNameL;
|
@property (nonatomic, weak) UILabel *timeL;
|
@end
|
@implementation PBModelsTableViewCell
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
self.contentView.backgroundColor = PBColor(244, 245, 246);
|
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(15);
|
make.right.equalTo(self.contentView).offset(-15);
|
make.bottom.equalTo(self.contentView);
|
}];
|
[bgV circleViewWithRadius:6];
|
|
UIImageView *modelImageV = [[UIImageView alloc] init];
|
[self.contentView addSubview:modelImageV];
|
[modelImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.left.equalTo(bgV).offset(10);
|
make.size.mas_equalTo(CGSizeMake(70, 70));
|
}];
|
[modelImageV circleViewWithRadius:6];
|
|
UILabel *modelNameL = [UILabel z_labelWithText:@"" Color:PBColor(40, 58, 79) isBold:YES Font:14];
|
modelNameL.numberOfLines = 2;
|
[self.contentView addSubview:modelNameL];
|
[modelNameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(modelImageV);
|
make.left.equalTo(modelImageV.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(modelImageV.mas_bottom);
|
make.left.right.equalTo(modelNameL);
|
make.height.equalTo(@16);
|
}];
|
self.modelImageV = modelImageV;
|
self.modelNameL = modelNameL;
|
self.timeL = timeL;
|
}
|
- (void)setModelsModel:(PBModelsModel *)modelsModel{
|
_modelsModel = modelsModel;
|
if([modelsModel.Thumbnail isEqualToString:@""]) {
|
self.modelImageV.image = [UIImage imageNamed:@"logo_unknown"];
|
}else {
|
self.modelImageV.image = [NSString imageDecoding:modelsModel.Thumbnail];
|
}
|
self.modelNameL.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)setSelected:(BOOL)selected animated:(BOOL)animated {
|
[super setSelected:selected animated:animated];
|
|
// Configure the view for the selected state
|
}
|
|
@end
|