单军华
2018-04-28 1d39caf7235522ae121db7a188ba41a706217407
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
//
//  SearchTipsCell.m
//  istanbul
//
//  Created by WindShan on 2017/6/16.
//  Copyright © 2017年 WindShan. All rights reserved.
//
 
#import "SearchTipsCell.h"
#import "GloriaLabel.h"
 
@interface SearchTipsCell()
{
    
}
 
@property (nonatomic, strong)     GloriaLabel * titleLabel;
@property (nonatomic, strong)     UIImageView * imageIcon;
@end
 
@implementation SearchTipsCell
 
/*
// 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.titleLabel.frame = CGRectMake(10+22+10, 15,SCREEN_WIDTH-(10+22+10), 22);
    self.imageIcon.frame = CGRectMake(10, 11, 22, 22);
}
 
- (UIImageView *)imageIcon
{
    if (!_imageIcon)
    {
        _imageIcon =  [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
        [self.contentView addSubview:_imageIcon];
    }
    
    return _imageIcon;
}
 
- (GloriaLabel *) titleLabel
{
    if(!_titleLabel)
    {
        _titleLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
        _titleLabel.font = [UIFont systemFontOfSize:14];
        _titleLabel.textAlignment = UITextAlignmentLeft;
        _titleLabel.textColor = kUIColorFromRGB(0x595959);
        [self.contentView addSubview:_titleLabel];
    }
    
    return _titleLabel;
}
 
- (void)setItemView:(NSString *) tips imgName:(NSString *) name
{
    self.imageIcon.image = [UIImage imageNamed:name];
    [self.titleLabel setText:tips];
}
 
@end