12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- //
- // YZMANineNineHeaderCollectionViewCell.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/18.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMANineNineHeaderCollectionViewCell.h"
- @implementation YZMANineNineHeaderCollectionViewCell
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.layer.cornerRadius = 3;
- self.layer.masksToBounds = YES;
- [self initSubviews];
- }
- return self;
- }
- - (void)initSubviews {
- [self.contentView.layer addSublayer:self.pictureLayer];
- }
- - (void)layoutSubviews {
- if (self.width == FITSIZE(171)) {
- _pictureLayer.frame = CGRectMake(0, 0, FITSIZE(171), FITSIZE(84));
- }
- else {
- _pictureLayer.frame = CGRectMake(0, 0, FITSIZE(83.5), FITSIZE(84));
- }
- }
- - (void)setModel:(YHNineNineHeaderCollectionModel *)model {
- _model = model;
- [self.pictureLayer yy_setImageWithURL:[NSURL URLWithString:model.icon] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
- }
- #pragma mark - lazy
- - (CALayer *)pictureLayer {
- if (!_pictureLayer) {
- _pictureLayer = [CALayer layer];
- _pictureLayer.backgroundColor = [UIColor clearColor].CGColor;
- }
- return _pictureLayer;
- }
- @end
|