YOUPAILZCarDressCell.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // YOUPAILZCarDressCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/23.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZCarDressCell.h"
  9. @interface YOUPAILZCarDressCell ()
  10. @property (nonatomic,weak)UIImageView *youpaipcarImgV;
  11. @property (nonatomic,weak)UILabel *youpaipnameL;
  12. @property (nonatomic,weak)UILabel *youpaiptimerL;
  13. @property (nonatomic,weak)UIImageView *youpaipselectedImgV;
  14. @end
  15. @implementation YOUPAILZCarDressCell
  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 *carImgV = [[UIImageView alloc] init];
  28. carImgV.contentMode = UIViewContentModeScaleAspectFill;
  29. [self.contentView addSubview:carImgV];
  30. self.youpaipcarImgV = carImgV;
  31. [carImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.top.offset(ScaleSize(13.0f));
  33. make.centerX.equalTo(self.contentView);
  34. make.size.mas_offset(CGSizeMake(ScaleSize(65.0f), ScaleSize(65.0f)));
  35. }];
  36. UILabel *nameL = [[UILabel alloc] init];
  37. nameL.font = LCFont(ScaleSize(11.0f));
  38. nameL.textColor = [UIColor whiteColor];
  39. nameL.textAlignment = NSTextAlignmentCenter;
  40. [self.contentView addSubview:nameL];
  41. self.youpaipnameL = nameL;
  42. [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.offset(ScaleSize(12.0f));
  44. make.top.equalTo(carImgV.mas_bottom).offset(ScaleSize(13.0f));
  45. make.right.offset(ScaleSize(-12.0f));
  46. }];
  47. UILabel *timerL = [[UILabel alloc] init];
  48. timerL.font = LCFont(ScaleSize(10.0f));
  49. timerL.textColor = HexColorFromRGB(0x9F9DA5);
  50. timerL.textAlignment = NSTextAlignmentCenter;
  51. [self.contentView addSubview:timerL];
  52. self.youpaiptimerL = timerL;
  53. [timerL mas_makeConstraints:^(MASConstraintMaker *make) {
  54. make.left.offset(ScaleSize(12.0f));
  55. make.top.equalTo(nameL.mas_bottom).offset(ScaleSize(4.0f));
  56. make.right.offset(ScaleSize(-12.0f));
  57. }];
  58. UIImageView *selectedImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_dress_selected"]];
  59. selectedImgV.hidden = YES;
  60. [self.contentView addSubview:selectedImgV];
  61. self.youpaipselectedImgV = selectedImgV;
  62. [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.right.top.offset(0.0f);
  64. make.size.mas_offset(CGSizeMake(ScaleSize(29.0f), ScaleSize(29.0f)));
  65. }];
  66. }
  67. -(void)youpaifreloadWithModel:(YOUPAILZDressModel *)model{
  68. self.youpaipnameL.text = model.youpaipname;
  69. self.youpaiptimerL.text = model.youpaipexpire;
  70. [self.youpaipcarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipfile]];
  71. // [[SDWebImageDownloader sharedDownloader] downloadImageWithURL:[LCTools getImageUrlWithAddress:model.file] options:SDWebImageDownloaderUseNSURLCache progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
  72. // self.bubbleImgV.image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height / 2.0f, image.size.width / 2.0f, image.size.height / 2.0f, image.size.width / 2.0f) resizingMode:UIImageResizingModeStretch];
  73. // }];
  74. if ([model.youpaipis_use isEqual:@"1"]) {
  75. self.youpaipselectedImgV.hidden = NO;
  76. self.layer.borderWidth = 1.5f;
  77. }else{
  78. self.youpaipselectedImgV.hidden = YES;
  79. self.layer.borderWidth = 0.0f;
  80. }
  81. }
  82. @end