萤石云 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//
//  HDLFVVisitorRecordCell.m
//  Ezviz
//
//  Created by 陈启扬 on 2022/4/29.
//  Copyright © 2022 hdl. All rights reserved.
//
 
#import "HDLEZVisitorRecordCell.h"
@interface HDLEZVisitorRecordCell(){
    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;//下划线
@property (nonatomic, strong)UIImageView *nextImgV;//右箭头
 
@end
@implementation HDLEZVisitorRecordCell
 
 
- (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_16);
        describeFont=HDLEZ_Get_FontRegularWithSize(HDLEZ_FontSize_12);
 
        [self initUI];
    }
    return self;
}
 
-(void)initUI{
    //右箭头
    _nextImgV =[[UIImageView alloc] init];
    [self.contentView addSubview:_nextImgV];
    [_nextImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-16);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.height.width.mas_equalTo(16);
    }];
    _nextImgV.image=[UIImage imageNamed:@"hdl_ez_list_next"];
 
    //标题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(_nextImgV.mas_left).offset(-5);
    }];
    
    //时间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.centerY.equalTo(self.contentView.mas_centerY);
        make.left.right.equalTo(_titleL);
        make.height.mas_equalTo(17);
    }];
 
    //描述L
    _describeL=[[UILabel alloc] init];
    _describeL.font=describeFont;
    _describeL.textColor=HDLEZ_COLOR_TEXT_LIGHT_GRAY;
    _describeL.adjustsFontSizeToFitWidth=YES;
    [self.contentView addSubview:_describeL];
    [_describeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).offset(-15);
        make.height.mas_equalTo(17);
        make.left.right.equalTo(_titleL);
    }];
    
//    //下划线
//    _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(_nextImgV.mas_right);
//        make.height.mas_equalTo(1);
//    }];
//    _lineV.backgroundColor=HDLEZ_COLOR_BACKGROUND_LINE;
 
}
 
/*时间戳转时间
 */
-(NSString *)turnDate:(NSString*)dateStr{
//    return   [HDLEZConstants turnDateString:dateStr toFormater:[NSString stringWithFormat:@"yyyy%@MM%@dd%@ HH:mm",HDLEZLocallizedString(@"Y"),HDLEZLocallizedString(@"M"),HDLEZLocallizedString(@"D")]];
    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 integerValue]]];;
}
 
-(void)setTitle:(NSString *)title{
    _title=title;
    _titleL.text=title;
}
 
-(void)setDescribe:(NSString *)describe{
    _describe=describe;
    _describeL.text=describe;
}
 
-(void)setTempInfo:(HDLEZTemInfoModel *)tempInfo{
    _tempInfo=tempInfo;
    
    //名称
    _titleL.text=[NSString stringWithFormat:@"%@",_tempInfo.userName];
    
    //时间
    _timeL.text=[NSString stringWithFormat:@"%@ - %@",[self turnDate:tempInfo.beginTime],[self turnDate:tempInfo.endTime]];
    
    //剩余次数
    if ([tempInfo.useCount isEqualToString:@"-1"]) {//不限次数
        _describeL.text=HDLEZLocallizedString(@"device_temp_unlimited_use_times");
        _describeL.textColor=HDLEZ_COLOR_TITLE_BLACK;
    }else{
        NSString *contentStr=[NSString stringWithFormat:@"%@%@%@",HDLEZLocallizedString(@"device_temp_left"),tempInfo.useCount,HDLEZLocallizedString(@"device_temp_times")];
        NSMutableAttributedString *attributedStringM = [[NSMutableAttributedString alloc] initWithString:contentStr];
        [attributedStringM addAttribute:NSForegroundColorAttributeName value:HDLEZ_COLOR_TITLE_BLACK range:NSMakeRange(contentStr.length-HDLEZLocallizedString(@"device_temp_times").length-tempInfo.useCount.length, tempInfo.useCount.length)];
        _describeL.attributedText=attributedStringM;
    }
 
    
    
}
@end