1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // YOUPAILZBubbleDressCell.m
- // VQU
- //
- // Created by CY on 2021/8/18.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZBubbleDressCell.h"
- @interface YOUPAILZBubbleDressCell()
- @property (nonatomic,weak)UIImageView *youpaipbubbleImgV;
- @property (nonatomic,weak)UILabel *youpaipnameL;
- @property (nonatomic,weak)UILabel *youpaiptimerL;
- @property (nonatomic,weak)UIImageView *youpaipselectedImgV;
- @end
- @implementation YOUPAILZBubbleDressCell
- - (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 *bubbleImgV = [[UIImageView alloc] init];
- [self.contentView addSubview:bubbleImgV];
- self.youpaipbubbleImgV = bubbleImgV;
- [bubbleImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(ScaleSize(38.0f));
- make.centerX.equalTo(self.contentView);
- make.size.mas_offset(CGSizeMake(ScaleSize(73.0f), ScaleSize(24.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(bubbleImgV.mas_bottom).offset(ScaleSize(30.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.youpaipbubbleImgV 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
|