// // QXNobilityDetailTopCell.m // QXLive // // Created by 启星 on 2025/11/8. // #import "QXNobilityDetailTopCell.h" #import "UIImage+QX.h" @interface QXNobilityDetailTopCell() @property (nonatomic,strong)UILabel *titleLabel; @property (nonatomic,strong)UIImageView *currentNobilityImageView; @end @implementation QXNobilityDetailTopCell - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self initSubViews]; } return self; } -(void)setIndex:(NSInteger)index{ _index = index; } -(void)setMyIndex:(NSInteger)myIndex{ _myIndex = myIndex; } -(void)setModel:(QXNobilityListModel *)model{ _model = model; if (self.myIndex<=self.index) { [self.currentNobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.image]]; }else{ [self.currentNobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.image] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { image = [UIImage qx_convertImageToGrayWithCoreImage:image]; self.currentNobilityImageView.image = image; }]; } self.titleLabel.text = model.name; } -(void)initSubViews{ self.backgroundColor = [UIColor clearColor]; self.currentNobilityImageView = [[UIImageView alloc] init]; self.currentNobilityImageView.contentMode = UIViewContentModeScaleAspectFill; [self.currentNobilityImageView addRoundedCornersWithRadius:7]; [self addSubview:self.currentNobilityImageView]; [self.currentNobilityImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.equalTo(self); make.width.height.mas_equalTo(220); make.centerX.equalTo(self); }]; self.titleLabel = [[UILabel alloc] init]; self.titleLabel.textColor = RGB16(0xF4C07C); self.titleLabel.textAlignment = NSTextAlignmentCenter; self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:34]; [self addSubview:self.titleLabel]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self); make.top.equalTo(self); make.height.mas_equalTo(44); }]; } @end