// // 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