YOUPAILZBadgeCell.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // YOUPAILZBadgeCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/30.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZBadgeCell.h"
  9. @interface YOUPAILZBadgeCell ()
  10. @property (nonatomic, weak) UIImageView *youpaipimgV;
  11. @property (nonatomic, weak) UILabel *youpaipnameL;
  12. @property (nonatomic, weak) UILabel *youpaipdescL;
  13. @property (nonatomic, weak) UILabel *youpaiptimerL;
  14. @property (nonatomic, weak) UIImageView *youpaipselectedImgV;
  15. @end
  16. @implementation YOUPAILZBadgeCell
  17. - (instancetype)initWithFrame:(CGRect)frame{
  18. if (self = [super initWithFrame:frame]) {
  19. [self youpaifinitUI];
  20. }
  21. return self;
  22. }
  23. - (void)youpaifinitUI{
  24. self.backgroundColor = HexColorFromRGB(0x2A2935);
  25. self.layer.cornerRadius = ScaleSize(9.0f);
  26. self.clipsToBounds = YES;
  27. self.layer.borderColor = HexColorFromRGB(0xF4003F).CGColor;
  28. UIImageView *imgV = [[UIImageView alloc] init];
  29. imgV.contentMode = UIViewContentModeScaleAspectFit;
  30. [self.contentView addSubview:imgV];
  31. self.youpaipimgV = imgV;
  32. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.top.offset(ScaleSize(14.0f));
  34. make.centerX.equalTo(self.contentView);
  35. make.size.mas_offset(CGSizeMake(ScaleSize(65.0f), ScaleSize(65.0f)));
  36. }];
  37. UILabel *nameL = [[UILabel alloc] init];
  38. nameL.font = LCFont(ScaleSize(11.0f));
  39. nameL.textColor = [UIColor whiteColor];
  40. nameL.textAlignment = NSTextAlignmentCenter;
  41. [self.contentView addSubview:nameL];
  42. self.youpaipnameL = nameL;
  43. [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.offset(ScaleSize(12.0f));
  45. make.top.equalTo(imgV.mas_bottom).offset(ScaleSize(13.0f));
  46. make.right.offset(ScaleSize(-12.0f));
  47. }];
  48. UILabel *descL = [[UILabel alloc] init];
  49. descL.font = LCFont(ScaleSize(10.0f));
  50. descL.textColor = HexColorFromRGB(0x9F9DA5);
  51. descL.textAlignment = NSTextAlignmentCenter;
  52. [self.contentView addSubview:descL];
  53. self.youpaipdescL = descL;
  54. [descL mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.offset(ScaleSize(12.0f));
  56. make.top.equalTo(nameL.mas_bottom).offset(ScaleSize(4.0f));
  57. make.right.offset(ScaleSize(-12.0f));
  58. }];
  59. UILabel *timerL = [[UILabel alloc] init];
  60. timerL.font = LCFont(ScaleSize(10.0f));
  61. timerL.textColor = HexColorFromRGB(0x9F9DA5);
  62. timerL.textAlignment = NSTextAlignmentCenter;
  63. [self.contentView addSubview:timerL];
  64. self.youpaiptimerL = timerL;
  65. [timerL mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.left.offset(ScaleSize(12.0f));
  67. make.top.equalTo(descL.mas_bottom).offset(ScaleSize(4.0f));
  68. make.right.offset(ScaleSize(-12.0f));
  69. }];
  70. UIImageView *selectedImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_dress_selected"]];
  71. selectedImgV.hidden = YES;
  72. [self.contentView addSubview:selectedImgV];
  73. self.youpaipselectedImgV = selectedImgV;
  74. [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.right.top.offset(0.0f);
  76. make.size.mas_offset(CGSizeMake(ScaleSize(29.0f), ScaleSize(29.0f)));
  77. }];
  78. }
  79. -(void)youpaifreloadWithModel:(YOUPAILZDressModel *)model{
  80. self.youpaipnameL.text = model.youpaipname;
  81. self.youpaipdescL.text = model.youpaipdetail;
  82. self.youpaiptimerL.text = model.youpaipexpire;
  83. [self.youpaipimgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipfile]];
  84. if ([model.youpaipis_use isEqual:@"1"]) {
  85. self.youpaipselectedImgV.hidden = NO;
  86. self.layer.borderWidth = 1.5f;
  87. }else{
  88. self.youpaipselectedImgV.hidden = YES;
  89. self.layer.borderWidth = 0.0f;
  90. }
  91. }
  92. @end