1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //
- // FKRecoUserCollectionViewCell.m
- // FirstLink
- //
- // Created by ascii on 16/2/18.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKRecoUserCollectionViewCell.h"
- @interface FKRecoUserCollectionViewCell ()
- @property (nonatomic, strong) UIView *imgBgView;
- @end
- @implementation FKRecoUserCollectionViewCell
- - (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.titleLabel.mas_bottom).offset(4);
- 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
|