//
|
// 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
|