天天省钱快报

KBFindTopCollectionViewCell.m 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // KBFindTopCollectionViewCell.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/19.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBFindTopCollectionViewCell.h"
  9. @implementation KBFindTopCollectionViewCell
  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)setModel:(KBFindHotSearchModel *)model {
  23. _model = model;
  24. [self.pictureLayer yy_setImageWithURL:[NSURL URLWithString:model.icon] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
  25. }
  26. #pragma mark - lazy
  27. - (CALayer *)pictureLayer {
  28. if (!_pictureLayer) {
  29. _pictureLayer = [CALayer layer];
  30. _pictureLayer.frame = CGRectMake(0, 0, FITSIZE(108), FITSIZE(75));
  31. _pictureLayer.backgroundColor = [UIColor clearColor].CGColor;
  32. }
  33. return _pictureLayer;
  34. }
  35. @end