123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // YOUPAILZCardDressCell.m
- // VQU
- //
- // Created by CY on 2021/9/6.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZCardDressCell.h"
- @interface YOUPAILZCardDressCell()
- @property (nonatomic,weak)UIImageView *youpaipcardImgV;
- @property (nonatomic,weak)UILabel *youpaipnameL;
- @property (nonatomic,weak)UILabel *youpaiptimerL;
- @property (nonatomic,weak)UIImageView *youpaipselectedImgV;
- @end
- @implementation YOUPAILZCardDressCell
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
-
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- self.backgroundColor = HexColorFromRGB(0x1C1D23);
- self.layer.cornerRadius = ScaleSize(9.0f);
- self.clipsToBounds = YES;
- self.layer.borderColor = HexColorFromRGB(0xF4003F).CGColor;
-
- UIImageView *cardImgV = [[UIImageView alloc] init];
- cardImgV.contentMode = UIViewContentModeScaleAspectFit;
- [self.contentView addSubview:cardImgV];
- self.youpaipcardImgV = cardImgV;
- [cardImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(ScaleSize(13.0f));
- make.centerX.equalTo(self.contentView);
- make.size.mas_offset(CGSizeMake(ScaleSize(65.0f), ScaleSize(65.0f)));
- }];
-
- UILabel *nameL = [[UILabel alloc] init];
- nameL.font = LCFont(ScaleSize(11.0f));
- nameL.textColor = [UIColor whiteColor];
- nameL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:nameL];
- self.youpaipnameL = nameL;
- [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(12.0f));
- make.top.equalTo(cardImgV.mas_bottom).offset(ScaleSize(13.0f));
- make.right.offset(ScaleSize(-12.0f));
- }];
-
- UILabel *timerL = [[UILabel alloc] init];
- timerL.font = LCFont(ScaleSize(10.0f));
- timerL.textColor = HexColorFromRGB(0x9F9DA5);
- timerL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:timerL];
- self.youpaiptimerL = timerL;
- [timerL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(12.0f));
- make.top.equalTo(nameL.mas_bottom).offset(ScaleSize(4.0f));
- make.right.offset(ScaleSize(-12.0f));
- }];
-
- UIImageView *selectedImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_dress_selected"]];
- selectedImgV.hidden = YES;
- [self.contentView addSubview:selectedImgV];
- self.youpaipselectedImgV = selectedImgV;
- [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.top.offset(0.0f);
- make.size.mas_offset(CGSizeMake(ScaleSize(29.0f), ScaleSize(29.0f)));
- }];
- }
- -(void)youpaifreloadWithModel:(YOUPAILZDressModel *)model{
- self.youpaipnameL.text = model.youpaipname;
- self.youpaiptimerL.text = model.youpaipexpire;
- [self.youpaipcardImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaippreview_img]];
-
- // [[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) {
- // 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];
- // }];
-
- if ([model.youpaipis_use isEqual:@"1"]) {
- self.youpaipselectedImgV.hidden = NO;
- self.layer.borderWidth = 1.5f;
- }else{
- self.youpaipselectedImgV.hidden = YES;
- self.layer.borderWidth = 0.0f;
- }
- }
- @end
|