一折买app------返利---------返利宝

YZMANineNineHeaderCollectionViewCell.m 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // YZMANineNineHeaderCollectionViewCell.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMANineNineHeaderCollectionViewCell.h"
  9. @implementation YZMANineNineHeaderCollectionViewCell
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.layer.cornerRadius = 3;
  14. self.layer.masksToBounds = YES;
  15. [self initSubviews];
  16. }
  17. return self;
  18. }
  19. - (void)initSubviews {
  20. [self.contentView.layer addSublayer:self.pictureLayer];
  21. }
  22. - (void)layoutSubviews {
  23. if (self.width == FITSIZE(171)) {
  24. _pictureLayer.frame = CGRectMake(0, 0, FITSIZE(171), FITSIZE(84));
  25. }
  26. else {
  27. _pictureLayer.frame = CGRectMake(0, 0, FITSIZE(83.5), FITSIZE(84));
  28. }
  29. }
  30. - (void)setModel:(YHNineNineHeaderCollectionModel *)model {
  31. _model = model;
  32. [self.pictureLayer yy_setImageWithURL:[NSURL URLWithString:model.icon] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
  33. }
  34. #pragma mark - lazy
  35. - (CALayer *)pictureLayer {
  36. if (!_pictureLayer) {
  37. _pictureLayer = [CALayer layer];
  38. _pictureLayer.backgroundColor = [UIColor clearColor].CGColor;
  39. }
  40. return _pictureLayer;
  41. }
  42. @end