萤石云 iOSSDK,移植跨平台相关工程
Davin
2024-12-18 b4e1288a9b63eb820e9c9489c56aac4bf6b31067
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
//
//  HDLEZDeviceMsgCell.m
//  EZSDK
//
//  Created by 陈启扬 on 2023/3/16.
//
 
#import "HDLEZDeviceMsgCell.h"
@interface HDLEZDeviceMsgCell(){
    UIFont *titleFont,*describeFont;
}
@property (nonatomic, strong)UILabel *titleL;//标题lable
@property (nonatomic, strong)UILabel *timeL;//时间lable
@property (nonatomic, strong)UILabel *describeL;//描述lable
@property (nonatomic, strong)UIView *lineV;//下划线
@end
@implementation HDLEZDeviceMsgCell
 
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
 
    // Configure the view for the selected state
}
 
-(instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        self.frame=frame;
        self.selectionStyle=UITableViewCellSelectionStyleNone;
        titleFont=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_14);
        describeFont=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
 
        [self initUI];
    }
    return self;
}
 
-(void)initUI{
    //标题L
    _titleL=[[UILabel alloc] init];
    _titleL.font=titleFont;
    _titleL.textColor=HDLEZ_COLOR_TITLE_BLACK;
    _titleL.adjustsFontSizeToFitWidth=YES;
    [self.contentView addSubview:_titleL];
    [_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(12);
        make.left.equalTo(self.contentView).offset(16);
        make.height.mas_equalTo(22);
        make.right.equalTo(self.contentView).offset(-16);
    }];
    
    //时间L
    _timeL=[[UILabel alloc] init];
    _timeL.font=describeFont;
    _timeL.textColor=HDLEZ_COLOR_TEXT_LIGHT_GRAY;
    _timeL.adjustsFontSizeToFitWidth=YES;
    [self.contentView addSubview:_timeL];
    [_timeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).offset(-12);
        make.left.equalTo(_titleL);
        make.height.mas_equalTo(17);
        make.width.mas_equalTo(120);
    }];
 
    //描述L
    _describeL=[[UILabel alloc] init];
    _describeL.font=describeFont;
    _describeL.textColor=HDLEZ_COLOR_TEXT_LIGHT_GRAY;
    _describeL.adjustsFontSizeToFitWidth=YES;
    _describeL.textAlignment=NSTextAlignmentRight;
    [self.contentView addSubview:_describeL];
    [_describeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).offset(-12);
        make.height.mas_equalTo(17);
        make.right.equalTo(_titleL);
        make.left.equalTo(_timeL.mas_right);
    }];
    
    //下划线
    _lineV=[[UIView alloc] init];
    [self.contentView addSubview:_lineV];
    [_lineV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_titleL.mas_left);
        make.bottom.equalTo(self.contentView);
        make.right.equalTo(_describeL.mas_right);
        make.height.mas_equalTo(1);
    }];
    _lineV.backgroundColor=HDLEZ_COLOR_BACKGROUND_LINE;
 
}
 
/*时间戳转时间
 */
-(NSString *)turnDate:(NSString*)dateStr{
    return [HDLEZConstants timeStrWithFormate:[NSString stringWithFormat:@"yyyy%@MM%@dd%@ HH:mm",HDLEZLocallizedString(@"device_temp_year"),HDLEZLocallizedString(@"device_temp_month"),HDLEZLocallizedString(@"device_temp_date")] data:[NSDate dateWithTimeIntervalSince1970:[dateStr doubleValue]/1000]];
}
 
 
/*设置消息值
 */
-(void)setMsgInfo:(HDLEZDeviceMsgInfoModel *)msgInfo{
    _msgInfo=msgInfo;
    
    _titleL.text=[HDLEZConstants turnNil:msgInfo.title] ;
    _timeL.text=[NSString stringWithFormat:@"%@",[self turnDate:msgInfo.createTime]];
    _describeL.text=[HDLEZConstants turnNil:msgInfo.content];
    
}
@end