123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- //
- // YOUPAILZBadgeCell.m
- // VQU
- //
- // Created by CY on 2021/8/30.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZBadgeCell.h"
- @interface YOUPAILZBadgeCell ()
- @property (nonatomic, weak) UIImageView *youpaipimgV;
- @property (nonatomic, weak) UILabel *youpaipnameL;
- @property (nonatomic, weak) UILabel *youpaipdescL;
- @property (nonatomic, weak) UILabel *youpaiptimerL;
- @property (nonatomic, weak) UIImageView *youpaipselectedImgV;
- @end
- @implementation YOUPAILZBadgeCell
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
-
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- self.backgroundColor = HexColorFromRGB(0x2A2935);
- self.layer.cornerRadius = ScaleSize(9.0f);
- self.clipsToBounds = YES;
- self.layer.borderColor = HexColorFromRGB(0xF4003F).CGColor;
-
- UIImageView *imgV = [[UIImageView alloc] init];
- imgV.contentMode = UIViewContentModeScaleAspectFit;
- [self.contentView addSubview:imgV];
- self.youpaipimgV = imgV;
- [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(ScaleSize(14.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(imgV.mas_bottom).offset(ScaleSize(13.0f));
- make.right.offset(ScaleSize(-12.0f));
- }];
-
- UILabel *descL = [[UILabel alloc] init];
- descL.font = LCFont(ScaleSize(10.0f));
- descL.textColor = HexColorFromRGB(0x9F9DA5);
- descL.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:descL];
- self.youpaipdescL = descL;
- [descL 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));
- }];
-
- 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(descL.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.youpaipdescL.text = model.youpaipdetail;
- self.youpaiptimerL.text = model.youpaipexpire;
- [self.youpaipimgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipfile]];
- 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
|