// // seaShellCell.m // ThePaperBase // // Created by Huixin on 15/10/26. // Copyright © 2015年 scar1900. All rights reserved. // #import "seaShellCell.h" @interface seaShellCell() @property(nonatomic, strong)UILabel *titleLabel; @property(nonatomic, strong)UIImageView *haibeiIcon; @property(nonatomic, strong)UILabel *todayLabel; @property(nonatomic, strong)UILabel *totalLabel; @property(nonatomic, strong)UIView *line; @property(nonatomic, strong)UIView *bottomView; @end @implementation seaShellCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.backgroundColor = [UIColor clearColor]; self.selectionStyle = UITableViewCellSelectionStyleNone; self.clipsToBounds = YES; [self addSubview:self.titleLabel]; [self addSubview:self.haibeiIcon]; [self addSubview:self.todayLabel]; [self addSubview:self.totalLabel]; [self addSubview:self.line]; [self addSubview:self.bottomView]; [self layoutViews]; } return self; } - (void)layoutViews { CGFloat padding = (rect_screen.size.width - 86) / 2; [self.titleLabel makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.top).offset(25); make.left.equalTo(self.left).offset(padding); make.height.mas_equalTo(@13); make.width.mas_equalTo(@67); }]; [self.haibeiIcon makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(@13.5); make.width.mas_equalTo(@15); make.left.equalTo(self.titleLabel.right).offset(4); make.bottom.equalTo(self.titleLabel.bottom); }]; [self.todayLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left); make.right.equalTo(self.right); make.height.mas_equalTo(@35); make.top.equalTo(self.titleLabel.bottom).equalTo(15); }]; [self.totalLabel makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left); make.right.equalTo(self.right); make.bottom.equalTo(self.line.top).offset(-10); make.height.mas_equalTo(@13); }]; [self.line makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left); make.right.equalTo(self.right); make.bottom.equalTo(self.bottomView.top); make.height.mas_equalTo(@0.5); }]; [self.bottomView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.left); make.right.equalTo(self.right); make.bottom.equalTo(self.bottom); make.height.mas_equalTo(@10); }]; } - (UILabel*)titleLabel { if (!_titleLabel) { _titleLabel = [UILabel new]; _titleLabel.backgroundColor = [UIColor clearColor]; _titleLabel.textColor = [UIColor colorWithHexString:TextLightGray]; _titleLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO); _titleLabel.textAlignment = NSTextAlignmentRight; _titleLabel.text = @"今日获得海贝"; } return _titleLabel; } - (UIImageView*)haibeiIcon { if (!_haibeiIcon) { _haibeiIcon = [UIImageView new]; _haibeiIcon.backgroundColor = [UIColor clearColor]; _haibeiIcon.image = Image(@"mall/haibeiIcon.png"); } return _haibeiIcon; } - (UILabel*)todayLabel { if (!_todayLabel) { _todayLabel = [UILabel new]; _todayLabel.backgroundColor = [UIColor clearColor]; _todayLabel.textColor = [UIColor colorWithHexString:BLUECOLOR]; _todayLabel.font = appFont(33, NO); _todayLabel.textAlignment = NSTextAlignmentCenter; } return _todayLabel; } - (UILabel*)totalLabel { if (!_totalLabel) { _totalLabel = [UILabel new]; _totalLabel.backgroundColor = [UIColor clearColor]; _totalLabel.textColor = [UIColor colorWithHexString:BLUECOLOR]; _totalLabel.font = appFont(TEXT_SIX_LEVELSIZE, NO); _totalLabel.textAlignment = NSTextAlignmentCenter; } return _totalLabel; } - (UIView*)line { if (!_line) { _line = [UIView new]; _line.backgroundColor = [UIColor colorWithHexString:LINECOLOR]; } return _line; } - (UIView*)bottomView { if (!_bottomView) { _bottomView = [UIView new]; _bottomView.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR]; } return _bottomView; } - (void)setTodaySeashells:(NSString *)todaySeashells { _todaySeashells = todaySeashells; self.todayLabel.text = todaySeashells; } - (void)setTotalSeashells:(NSString *)totalSeashells { _totalSeashells = totalSeashells; self.totalLabel.text = [NSString stringWithFormat:@"%@:%@", @"全部海贝", totalSeashells]; } - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end