// // YOUPAILZLiveManageCell.m // VQU // // Created by CY on 2021/8/25. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAILZLiveManageCell.h" @interface YOUPAILZLiveManageCell () @property (nonatomic,strong) YOUPAILZLiveManageModel *youpaipmodel; @property (nonatomic,strong) NSIndexPath *youpaipindexPath; @property (nonatomic,weak) UIImageView *youpaipavatarImgV; @property (nonatomic,weak) UILabel *youpaipnicknameL; @property (nonatomic,weak) UIImageView *youpaipsexV; @end @implementation YOUPAILZLiveManageCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = [UIColor clearColor]; [self youpaifinitUI]; } return self; } - (void)youpaifinitUI{ UIImageView *youpaipavatarImgV = [[UIImageView alloc] init]; youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill; youpaipavatarImgV.layer.cornerRadius = 20.0f; youpaipavatarImgV.clipsToBounds = YES; youpaipavatarImgV.layer.borderWidth = 1.0f; youpaipavatarImgV.layer.borderColor = HexColorFromRGB(0x9F9DA5).CGColor; [self.contentView addSubview:youpaipavatarImgV]; self.youpaipavatarImgV = youpaipavatarImgV; [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(20.0f); make.centerY.mas_equalTo(self.contentView.mas_centerY); make.size.mas_equalTo(CGSizeMake(40.0f, 40.0f)); }]; UILabel *youpaipnicknameL = [[UILabel alloc] init]; youpaipnicknameL.font = LCBoldFont(14.0f); youpaipnicknameL.textColor = [UIColor whiteColor]; [self.contentView addSubview:youpaipnicknameL]; self.youpaipnicknameL = youpaipnicknameL; [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipavatarImgV.mas_right).offset(8.0f); make.centerY.mas_equalTo(self.contentView.mas_centerY); }]; UIImageView *youpaipsexV = [[UIImageView alloc] init]; [self.contentView addSubview:youpaipsexV]; self.youpaipsexV = youpaipsexV; [youpaipsexV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f); make.centerY.equalTo(youpaipnicknameL); make.size.mas_offset(CGSizeMake(15.0f, 15.0f)); }]; UIButton *repealBtn = [UIButton buttonWithType:UIButtonTypeCustom]; repealBtn.layer.cornerRadius = 11.0f; repealBtn.clipsToBounds = YES; [repealBtn setTitle:@"撤销" forState:UIControlStateNormal]; [repealBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; repealBtn.titleLabel.font = LCFont12; repealBtn.backgroundColor = HexColorFromRGB(0x4F4B5B); [repealBtn addTarget:self action:@selector(youpaifrepealBtnClick) forControlEvents:UIControlEventTouchUpInside]; [self.contentView addSubview:repealBtn]; [repealBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.contentView); make.right.offset(-14.0f); make.size.mas_offset(CGSizeMake(56.0f, 22.0f)); }]; } - (void)youpaifreloadWithModel:(YOUPAILZLiveManageModel *)model indexPath:(NSIndexPath *)indexPath{ self.youpaipmodel = model; self.youpaipindexPath = indexPath; [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipavatar]]; self.youpaipnicknameL.text = model.youpaipnickname; if (model.youpaipgender == 1) {//0未知 1女 2男 self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"]; }else{ self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"]; } } - (void)youpaifrepealBtnClick{ if (self.youpaiprepealBlock != nil) { self.youpaiprepealBlock(self.youpaipmodel, self.youpaipindexPath); } } @end