123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // KBFindMiddleCollectionViewCell.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/19.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBFindMiddleCollectionViewCell.h"
- @implementation KBFindMiddleCollectionViewCell
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self initSubviews];
- }
- return self;
- }
- - (void)initSubviews {
- [self.contentView.layer addSublayer:self.pictureLayer];
-
- [self.contentView addSubview:self.nameLabel];
-
- [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.contentView);
- make.top.equalTo(self.contentView).offset(FITSIZE((48+3)));
- }];
- }
- - (void)setModel:(KBFindChannelModel *)model {
- _model = model;
- [self.pictureLayer yy_setImageWithURL:[NSURL URLWithString:model.icon] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
- self.nameLabel.text = model.name;
- }
- #pragma mark - lazy {
- - (CALayer *)pictureLayer {
- if (!_pictureLayer) {
- _pictureLayer = [CALayer layer];
- _pictureLayer.backgroundColor = [UIColor clearColor].CGColor;
- _pictureLayer.frame = CGRectMake(kScreenWidth/8-48/2, 0, FITSIZE(48), FITSIZE(48));
- }
- return _pictureLayer;
- }
- - (UILabel *)nameLabel {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc] init];
- _nameLabel.textColor = [UIColor YHColorWithHex:0x666666];
- _nameLabel.font = [UIFont systemFontOfSize:FITSIZE(12)];
- _nameLabel.textAlignment = NSTextAlignmentCenter;
- }
- return _nameLabel;
- }
- @end
|