YOUPAILZBubbleDressCell.m 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // YOUPAILZBubbleDressCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/18.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZBubbleDressCell.h"
  9. @interface YOUPAILZBubbleDressCell()
  10. @property (nonatomic,weak)UIImageView *youpaipbubbleImgV;
  11. @property (nonatomic,weak)UILabel *youpaipnameL;
  12. @property (nonatomic,weak)UILabel *youpaiptimerL;
  13. @property (nonatomic,weak)UIImageView *youpaipselectedImgV;
  14. @end
  15. @implementation YOUPAILZBubbleDressCell
  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 *bubbleImgV = [[UIImageView alloc] init];
  28. [self.contentView addSubview:bubbleImgV];
  29. self.youpaipbubbleImgV = bubbleImgV;
  30. [bubbleImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.offset(ScaleSize(38.0f));
  32. make.centerX.equalTo(self.contentView);
  33. make.size.mas_offset(CGSizeMake(ScaleSize(73.0f), ScaleSize(24.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(bubbleImgV.mas_bottom).offset(ScaleSize(30.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.youpaipbubbleImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaippreview_img]];
  70. // [[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) {
  71. // 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];
  72. // }];
  73. if ([model.youpaipis_use isEqual:@"1"]) {
  74. self.youpaipselectedImgV.hidden = NO;
  75. self.layer.borderWidth = 1.5f;
  76. }else{
  77. self.youpaipselectedImgV.hidden = YES;
  78. self.layer.borderWidth = 0.0f;
  79. }
  80. }
  81. @end