YOUPAILZAvatarDressCell.m 3.2 KB

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