12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- //
- // LDSuperBrandCollectionCell.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/12/11.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDSuperBrandCollectionCell.h"
- @interface LDSuperBrandCollectionCell ()
- @property (nonatomic, strong) UIImageView *bgImgView;
- @property (nonatomic, strong) UILabel *titleLabel;
- @property (nonatomic, strong) UILabel *desLabel;
- @end
- @implementation LDSuperBrandCollectionCell
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- [self.contentView addSubview:self.bgImgView];
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.desLabel];
-
- [self.bgImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
- }];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.left.mas_equalTo(0);
- make.top.mas_equalTo(62);
- }];
-
- [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(0);
- make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(3);
- }];
-
-
- }
- - (void)setModel:(LDSuperBrandModel *)model {
- [self.bgImgView sd_setFadeImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil options:0 progress:nil completed:nil];
- self.titleLabel.text = model.name;
- self.desLabel.text = model.note;
- }
- - (UIImageView *)bgImgView {
- if (!_bgImgView) {
- _bgImgView = [[UIImageView alloc] init];
- }
- return _bgImgView;
- }
- - (UILabel *)titleLabel {
- if (!_titleLabel) {
- _titleLabel = [[UILabel alloc] init];
- _titleLabel.textAlignment = NSTextAlignmentCenter;
- _titleLabel.font = [UIFont systemFontOfSize:12];
- _titleLabel.textColor = [UIColor YHColorWithHex:0x4A4A4A];
- }
- return _titleLabel;
- }
- - (UILabel *)desLabel {
- if (!_desLabel) {
- _desLabel = [[UILabel alloc] init];
- _desLabel.font = [UIFont systemFontOfSize:8];
- _desLabel.textColor = [UIColor YHColorWithHex:0x9B9B9B];
- _desLabel.textAlignment = NSTextAlignmentCenter;
- }
- return _desLabel;
- }
- @end
|