单军华
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
//
//  HotelCell.m
//  istanbul
//
//  Created by WindShan on 2017/6/16.
//  Copyright © 2017年 WindShan. All rights reserved.
//
 
#import "NoticeCell.h"
#import "GloriaLabel.h"
 
@interface NoticeCell()
{
    
}
 
@property (nonatomic, strong)     GloriaLabel * noticeLabel;
@property (nonatomic, strong)     GloriaLabel * timeLabel;
@property (nonatomic, strong)     UIImageView * bkImage;
@end
 
@implementation NoticeCell
 
/*
// 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.noticeLabel.frame = CGRectMake(20, 5, SCREEN_WIDTH-40, 20);
    self.timeLabel.frame = CGRectMake(20, 25, SCREEN_WIDTH-40, 30);
    self.bkImage.frame = CGRectMake(10, 0, SCREEN_WIDTH-20, 60);
}
 
- (UIImageView *)bkImage
{
    if (!_bkImage)
    {
        _bkImage =  [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-20, 60)];
        [self.contentView addSubview:_bkImage];
    }
    
    return _bkImage;
}
 
- (GloriaLabel *) timeLabel
{
    if(!_timeLabel)
    {
        _timeLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
        _timeLabel.font = [UIFont systemFontOfSize:16];
        _timeLabel.textAlignment = UITextAlignmentLeft;
        _timeLabel.textColor = kUIColorFromRGB(0xa9a9a9);
        [self.contentView addSubview:_timeLabel];
    }
    
    return _timeLabel;
}
 
- (GloriaLabel *) noticeLabel
{
    if(!_noticeLabel)
    {
        _noticeLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
        _noticeLabel.font = [UIFont systemFontOfSize:16];
        _noticeLabel.textAlignment = UITextAlignmentLeft;
        _noticeLabel.textColor = kUIColorFromRGB(0x5a5a5a);
        [self.contentView addSubview:_noticeLabel];
    }
    
    return _noticeLabel;
}
 
- (void)setItemView:(NoticeModel*)model
{
    self.bkImage.image = [UIImage imageNamed:@"ic_notice_bk"];
    //self.contentView.backgroundColor = [UIColor blueColor];
    [self.noticeLabel setText:model.title];
    
    [self.timeLabel setText:[DateUtil stringFromLong:model.created]];
}
 
@end