SelectVCollectionViewCell.m 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // SelectVCollectionViewCell.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/5/8.
  6. //
  7. #import "SelectVCollectionViewCell.h"
  8. @interface SelectVCollectionViewCell ()
  9. @end
  10. @implementation SelectVCollectionViewCell
  11. - (instancetype)initWithFrame:(CGRect)frame
  12. {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. [self tt_addSubViews];
  16. }
  17. return self;
  18. }
  19. -(void)tt_addSubViews{
  20. UIView *bgView= [[UIView alloc]initWithFrame:self.frame];
  21. bgView.layer.cornerRadius = 8;
  22. bgView.layer.borderColor = [UIColor qmui_colorWithHexString:@"#043632"].CGColor;
  23. bgView.layer.borderWidth =2;
  24. bgView.clipsToBounds = YES;
  25. self.selectedBackgroundView = bgView;
  26. [self.contentView addSubview:self.imgV];
  27. [self.imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.mas_equalTo(5);
  29. make.right.mas_equalTo(-5);
  30. make.top.mas_equalTo(5);
  31. make.bottom.mas_equalTo(-5);
  32. }];
  33. }
  34. - (UIImageView *)imgV {
  35. if (!_imgV) {
  36. _imgV = [[UIImageView alloc] initWithImage:nil];
  37. _imgV.contentMode = UIViewContentModeScaleAspectFill;
  38. _imgV.layer.cornerRadius = 4;
  39. _imgV.clipsToBounds = YES;
  40. }
  41. return _imgV;
  42. }
  43. @end