//
|
// MyDeviceStatusCell.m
|
// terminalMgr
|
//
|
// Created by WindShan on 2017/3/16.
|
// Copyright © 2017年 WindShan. All rights reserved.
|
//
|
|
#import "ChangeDeviceCell.h"
|
#import "GloriaLabel.h"
|
#import "UIImageView+WebCache.h"
|
#import "commenProgressView.h"
|
|
@interface ChangeDeviceCell()
|
{
|
|
}
|
|
@property (nonatomic, strong) UIImageView * bkImage;
|
@property (nonatomic, strong) UIImageView * file_name_tag;
|
@property (nonatomic, strong) UIImageView * file_name_line;
|
@property (nonatomic, strong) GloriaLabel * fileName;
|
@property (nonatomic, strong) GloriaLabel * room_No;
|
@property (nonatomic, strong) UIImageView * lw_status;
|
@property (nonatomic, strong) GloriaLabel * lw_change_status;
|
|
@end
|
|
@implementation ChangeDeviceCell
|
|
/*
|
// Only override drawRect: if you perform custom drawing.
|
// An empty implementation adversely affects performance during animation.
|
- (void)drawRect:(CGRect)rect {
|
// Drawing code
|
}
|
*/
|
|
- (GloriaLabel *) lw_change_status
|
{
|
if(!_lw_change_status)
|
{
|
_lw_change_status = [[GloriaLabel alloc] initWithFrame:CGRectMake(8+10+45, 5,50, 50)];
|
_lw_change_status.font = [UIFont systemFontOfSize:8];
|
_lw_change_status.textAlignment = UITextAlignmentLeft;
|
_lw_change_status.textColor = kUIColorFromRGB(0x5a5a5a);
|
[self.contentView addSubview:_lw_change_status];
|
}
|
|
return _lw_change_status;
|
}
|
|
|
- (UIImageView *)lw_status
|
{
|
if (!_lw_status)
|
{
|
_lw_status = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5, 2, 60)];
|
[self.contentView addSubview:_lw_status];
|
}
|
|
return _lw_status;
|
}
|
|
- (GloriaLabel *) room_No
|
{
|
if(!_room_No)
|
{
|
_room_No = [[GloriaLabel alloc] initWithFrame:CGRectMake(8+10+45, 5,SCREEN_WIDTH/2, 30)];
|
_room_No.font = [UIFont systemFontOfSize:12];
|
_room_No.textAlignment = UITextAlignmentLeft;
|
_room_No.textColor = kUIColorFromRGB(0x5a5a5a);
|
[self.contentView addSubview:_room_No];
|
}
|
|
return _room_No;
|
}
|
|
|
- (GloriaLabel *) fileName
|
{
|
if(!_fileName)
|
{
|
_fileName = [[GloriaLabel alloc] initWithFrame:CGRectMake(8+10+45, 5,SCREEN_WIDTH/2, 30)];
|
_fileName.font = [UIFont systemFontOfSize:12];
|
_fileName.textAlignment = UITextAlignmentLeft;
|
_fileName.textColor = kUIColorFromRGB(0x6e6e6e);
|
[self.contentView addSubview:_fileName];
|
}
|
|
return _fileName;
|
}
|
|
- (UIImageView *)file_name_tag
|
{
|
if (!_file_name_tag)
|
{
|
_file_name_tag = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5, 2, 60)];
|
[self.contentView addSubview:_file_name_tag];
|
}
|
|
return _file_name_tag;
|
}
|
|
- (UIImageView *)bkImage
|
{
|
if (!_bkImage)
|
{
|
|
CGFloat bkImageW = 708;
|
if(IsiPhone4 || IsiPhone5)
|
{
|
bkImageW = 620;
|
}
|
|
_bkImage = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-bkImageW)/2-10, 0, bkImageW-20, 60)];
|
[self.contentView addSubview:_bkImage];
|
}
|
|
return _bkImage;
|
}
|
|
|
|
- (UIImageView *)file_name_line
|
{
|
if (!_file_name_line)
|
{
|
_file_name_line = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5, SCREEN_WIDTH-16, 60)];
|
_file_name_line.image = [UIImage imageNamed:@"ic_device_line"];
|
[self.contentView addSubview:_file_name_line];
|
}
|
|
return _file_name_line;
|
}
|
|
//@property (nonatomic, strong) UIImageView * bkImage;
|
//@property (nonatomic, strong) UIImageView * iconImage;
|
//@property (nonatomic, strong) UIImageView * nameCircleImage;
|
//@property (nonatomic, strong) UIImageView * statusCircleImage;
|
//@property (nonatomic, strong) GloriaLabel * deviceName;
|
//@property (nonatomic, strong) GloriaLabel * FileStatus;
|
|
- (void)layoutSubviews
|
{
|
[super layoutSubviews];
|
|
CGFloat bkImageW = 356;
|
CGFloat btnW = 118;
|
CGFloat leftOffX = 10;
|
CGFloat lineOffX = 0;
|
if(IsiPhone4 || IsiPhone5)
|
{
|
bkImageW = 300;
|
btnW = 105;
|
leftOffX = 0;
|
lineOffX = 10;
|
}
|
|
self.lw_status.frame = CGRectMake(SCREEN_WIDTH-20-55, 15, 55, 55);
|
|
self.bkImage.frame = CGRectMake((SCREEN_WIDTH-bkImageW)/2, 10, bkImageW, 70 );
|
self.file_name_tag.frame = CGRectMake((SCREEN_WIDTH-bkImageW)/2+10, 17, 2, 16);
|
self.file_name_line.frame = CGRectMake((SCREEN_WIDTH-bkImageW+20)/2, 40, bkImageW-self.lw_status.frame.size.width-30, 1);
|
|
self.fileName.frame = CGRectMake((SCREEN_WIDTH-bkImageW)/2+10+10, 10, SCREEN_WIDTH/2, 30);
|
self.room_No.frame = CGRectMake(20, 45, bkImageW-20, 20);
|
|
// 滤网正常 滤网需更换
|
self.lw_change_status.frame = CGRectMake(SCREEN_WIDTH-20-55, 15, 54, 54);
|
self.lw_change_status.font = [UIFont systemFontOfSize:10];
|
self.lw_change_status.numberOfLines = 0;//上面两行设置多行显示
|
self.lw_change_status.textAlignment = UITextAlignmentCenter;
|
}
|
|
/** 设置数据*/
|
- (void)setItemView:(DeviceLw*)model
|
{
|
self.modelLW = model;
|
self.contentView.backgroundColor = [UIColor clearColor];
|
|
self.bkImage.image = [UIImage imageNamed:@"ic_device_lw_bk"];
|
//self.bkImage.backgroundColor = [UIColor redColor];
|
self.file_name_tag.image = [UIImage imageNamed:@"ic_devicename_tag"];
|
self.lw_status.image = [UIImage imageNamed:@"lw_chaneg_bk"];
|
|
[self.fileName setText:[NSString stringWithFormat:@"设备名称:%@",model.device_id.name]];
|
[self.fileName setTextColor:kUIColorFromRGB(0x00b742)];
|
|
//@property(nonatomic, strong) NSString * name;//": "北京海淀一店"
|
//self.modelLW.device_id.room_id.name;
|
[self.room_No setText:[NSString stringWithFormat:@"所在酒店:%@ %@号房",self.modelLW.device_id.hotel_id.name,self.modelLW.device_id.room_id.name]];
|
|
//[self.lw_change_status setText:@"滤网\n需更换"];
|
//[self.lw_change_status setTextColor:kUIColorFromRGB(0xfc7411)];
|
// fs_status;//0不更换,1更换
|
self.lw_status.image = [UIImage imageNamed:model.status == 0 ? @"lw_normal_bk":@"lw_chaneg_bk"];
|
[self.lw_change_status setText:model.status == 0 ?@"滤网\n正常":@"滤网\n需保养"];
|
[self.lw_change_status setTextColor:model.status == 0 ?kUIColorFromRGB(0x00b742):kUIColorFromRGB(0xfc7411)];
|
|
|
}
|
@end
|