单军华
2018-03-29 89d748b77b478905732e60f0b4c5807c274b6565
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//
//  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