// // FKExploreNormalCell.m // FirstLink // // Created by ascii on 16/2/18. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKExploreNormalCell.h" @interface FKExploreNormalCell () @property (nonatomic, strong) UIView *imgBgView; @end @implementation FKExploreNormalCell - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self addAllSubviews]; } return self; } - (void)addAllSubviews { [self.contentView addSubview:self.imgBgView]; [self.imgBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.contentView); make.top.equalTo(self.contentView).offset(10); make.height.equalTo(self.contentView.mas_width); }]; [self.imgBgView addSubview:self.imageView]; [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.imgBgView); make.top.equalTo(self.imgBgView); make.height.equalTo(self.imageView.mas_width); }]; // [self.contentView addSubview:self.titleLabel]; // [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.right.equalTo(self.contentView); // make.top.equalTo(self.imgBgView.mas_bottom).offset(8); // make.height.mas_equalTo(15); // }]; [self.contentView addSubview:self.priceLabel]; [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.contentView); make.top.equalTo(self.imageView.mas_bottom).offset(8); make.height.mas_equalTo(18); }]; } #pragma mark - Property - (UIView *)imgBgView { if (!_imgBgView) { _imgBgView = [UIView new]; // _imgBgView.layer.borderWidth = 1.0/[UIScreen mainScreen].scale; // _imgBgView.layer.borderColor = UIColorFromRGB(0xe5e5e5).CGColor; } return _imgBgView; } - (UIImageView *)imageView { if (!_imageView) { _imageView = [UIImageView new]; _imageView.contentMode = UIViewContentModeScaleAspectFit; } return _imageView; } - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [UILabel new]; _titleLabel.textColor = UIColorFromRGB(0x666666); _titleLabel.font = [UIFont systemFontOfSize:12]; _titleLabel.textAlignment = NSTextAlignmentCenter; } return _titleLabel; } - (UILabel *)priceLabel { if (!_priceLabel) { _priceLabel = [UILabel new]; _priceLabel.textColor = UIColorFromRGB(0xff624a); _priceLabel.textAlignment = NSTextAlignmentCenter; } return _priceLabel; } @end