单军华
2018-03-28 f99cf1d5cc50407394501853be06cb39f38a092c
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
//
//  ControlViewCell.m
//  GoldRich
//
//  Created by WindShan on 2017/2/20.
//  Copyright © 2017年 WindShan. All rights reserved.
//
 
#import "ControlViewCell.h"
#import "GloriaLabel.h"
 
@interface ControlViewCell()
 
@property (nonatomic, strong)  UIImageView * bkImage;
@property (nonatomic, strong)  UIImageView * shiduImage;
@property (nonatomic, strong)  GloriaLabel * shuiliangLabel;
@property (nonatomic, strong)  GloriaLabel * levelLabel;
 
@property (nonatomic, strong)  GloriaLabel * feiTipsLabel;
 
@property (nonatomic, strong)  UIImageView * arrowImage;
@property (nonatomic, strong)  UIImageView * lightBKImage;
@property (nonatomic, assign)  CGFloat  offsetHeight;
 
@end
 
@implementation ControlViewCell
 
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
 
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.bkImage.frame = CGRectMake(0, 5+_offsetHeight, SCREEN_WIDTH, 66);
    self.shiduImage.frame = CGRectMake(10, 10+_offsetHeight, 50, 50);
    self.arrowImage.frame = CGRectMake(SCREEN_WIDTH-20-10,27+_offsetHeight, 10, 15);
 
    self.shuiliangLabel.frame = CGRectMake(10+50+10, 28+_offsetHeight,70, 16);
    self.levelLabel.frame = CGRectMake(10+50+10+80, 28+_offsetHeight,150, 14);
    
    self.lightBKImage.frame = CGRectMake(0, -37, SCREEN_WIDTH, 75);
    self.feiTipsLabel.frame = CGRectMake(10+50+10+80+60, 28+_offsetHeight,70, 16);
}
 
- (UIImageView *)lightBKImage
{
    if (!_lightBKImage)
    {
        _lightBKImage =  [[UIImageView alloc] initWithFrame:CGRectMake(0, -37, SCREEN_WIDTH, 75)];
        [self.contentView addSubview:_lightBKImage];
    }
    
    return _lightBKImage;
}
 
- (UIImageView *)bkImage
{
    if (!_bkImage)
    {
        _bkImage =  [[UIImageView alloc] initWithFrame:CGRectMake(0, 5+_offsetHeight, SCREEN_WIDTH, 66)];
        [self.contentView addSubview:_bkImage];
    }
    
    return _bkImage;
}
- (UIImageView *)shiduImage
{
    if (!_shiduImage)
    {
        _shiduImage =  [[UIImageView alloc] initWithFrame:CGRectMake(10, 5+_offsetHeight, 50, 50)];
        [self.contentView addSubview:_shiduImage];
    }
    
    return _shiduImage;
}
- (UIImageView *)arrowImage
{
    if (!_arrowImage)
    {
        _arrowImage =  [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-20-10,22+_offsetHeight, 10, 15)];
        [self.contentView addSubview:_arrowImage];
    }
    
    return _arrowImage;
}
 
- (GloriaLabel *) levelLabel
{
    if(!_levelLabel)
    {
        _levelLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10, 23+_offsetHeight,70, 16)];
        _levelLabel.font = [UIFont systemFontOfSize:10];
        _levelLabel.textAlignment = UITextAlignmentLeft;
        _levelLabel.textColor = RgbColor(106,107,107);
        [self.contentView addSubview:_levelLabel];
    }
    
    return _levelLabel;
}
 
- (GloriaLabel *) feiTipsLabel
{
    if(!_feiTipsLabel)
    {
        _feiTipsLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-20-10-120, 23+_offsetHeight,70, 16)];
        _feiTipsLabel.font = [UIFont systemFontOfSize:14];
        _feiTipsLabel.textAlignment = UITextAlignmentLeft;
        _feiTipsLabel.textColor = RgbColor(106,107,107);
        [self.contentView addSubview:_feiTipsLabel];
    }
    
    return _feiTipsLabel;
}
 
 
- (GloriaLabel *) shuiliangLabel
{
    if(!_shuiliangLabel)
    {
        _shuiliangLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28+_offsetHeight,150, 14)];
        _shuiliangLabel.font = [UIFont systemFontOfSize:16];
        _shuiliangLabel.textAlignment = UITextAlignmentLeft;
        [self.contentView addSubview:_shuiliangLabel];
    }
    
    return _shuiliangLabel;
}
 
 
 
- (void)setItemView:(NSString*)shuiliangStr levelName:(NSString*)levelStr shiduImage:(NSString*)imageName isShowlightBK:(BOOL)isShow
{
    if( isShow)
    {
        _offsetHeight = 10;
        self.lightBKImage.image = [UIImage imageNamed:@"lightBK"];
    }
    
    self.bkImage.image =  [UIImage imageNamed:@"control_bk"];
    self.shiduImage.image =  [UIImage imageNamed:imageName];
    
    [self.shuiliangLabel setText:shuiliangStr];
    
    [self.levelLabel setText:levelStr];
    
    self.arrowImage.image =  [UIImage imageNamed:@"右部箭头"];
    
    if( isShow)
    {
        [self.feiTipsLabel setText:@"(FEI)"];
    }
}
 
@end