萤石云 iOSSDK,移植跨平台相关工程
Davin
2023-06-15 011b0cc918bfa0e36a9ad4a0f45c18b801815920
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//
//  HDLEZVideoDoorMsgCell.m
//  EZSDK
//
//  Created by Davin on 2023/6/15.
//
 
#import "HDLEZVideoDoorMsgCell.h"
 
@interface HDLEZVideoDoorMsgCell ()
 
@property (strong, nonatomic) UILabel *messageTitle;
@property (strong, nonatomic) UILabel *statusLabel;
@property (strong, nonatomic) UILabel *timeLabel;
@property (strong, nonatomic) UIImageView *messageImageView;
 
@end
 
@implementation HDLEZVideoDoorMsgCell
 
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createSubviews];
    }
    return self;
}
 
- (void)createSubviews {
    self.contentView.backgroundColor = UIColor.whiteColor;
    [self.contentView addSubview:self.messageTitle];
    [self.contentView addSubview:self.statusLabel];
    [self.contentView addSubview:self.timeLabel];
    [self.contentView addSubview:self.messageImageView];
    
    [self.messageTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(16.);
        make.left.mas_equalTo(self.contentView.mas_left).offset(16.);
        make.height.mas_equalTo(22);
    }];
    
    [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.messageTitle.mas_bottom).offset(10.);
        make.left.mas_equalTo(self.messageTitle.mas_left);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(30);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.messageTitle.mas_left);
        make.bottom.mas_equalTo(self.messageImageView.mas_bottom);
        make.right.mas_equalTo(self.messageTitle.mas_right);
        make.height.mas_equalTo(22);
    }];
    
    [self.messageImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top).offset(16.);
        make.left.mas_equalTo(self.messageTitle.mas_right).offset(10.);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-16.);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-16.);
        make.width.mas_equalTo(self.messageImageView.mas_height).multipliedBy(5/3.);
    }];
}
 
#pragma mark - PublishMethod
- (void)configMessageInfoWithTitle:(NSString *)title deviceStatus:(NSString *)deviceStatus messageTime:(NSString *)time messageImage:(NSString *)messageUrl {    
    if (title && title.length > 0) {
        self.messageTitle.text = title;
    }
    if (deviceStatus && deviceStatus.length > 0) {
        self.statusLabel.text = deviceStatus;
    }
    if (time && time.length > 0) {
        self.timeLabel.text = time;
    }
    if (messageUrl && messageUrl.length > 0) {
        NSLog(@"#######cell image url:%@", messageUrl);
        [self.messageImageView sd_setImageWithURL:[NSURL URLWithString:messageUrl] placeholderImageScale:[UIImage imageNamed:@""]];
    }
}
 
#pragma mark - Getter
- (UILabel *)messageTitle {
    if (!_messageTitle) {
        _messageTitle=[[UILabel alloc] init];
        _messageTitle.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14);
        _messageTitle.textColor=HDLEZ_COLOR_TITLE_BLACK;
    }
    return _messageTitle;
}
 
- (UILabel *)statusLabel {
    if (!_statusLabel) {
        _statusLabel=[[UILabel alloc] init];
        _statusLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
        _statusLabel.textColor = HDLEZ_COLOR_TEXT_LIGHT_GRAY;
        _statusLabel.layer.cornerRadius = 5;
        _statusLabel.layer.borderColor = HDLEZ_COLOR_TEXT_GRAY.CGColor;
        _statusLabel.clipsToBounds = YES;
    }
    return _statusLabel;
}
 
- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel=[[UILabel alloc] init];
        _timeLabel.font = HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
        _timeLabel.textColor=HDLEZ_COLOR_TEXT_GRAY;
        _timeLabel.textAlignment = NSTextAlignmentRight;
    }
    return _timeLabel;
}
 
- (UIImageView *)messageImageView {
    if (!_messageImageView) {
        _messageImageView = [[UIImageView alloc] init];
        _messageImageView.backgroundColor = HDLEZ_COLOR_TEXT_LIGHT_GRAY;
        
    }
    return _messageImageView;
}
 
@end