zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
//  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