123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- //
- // YOUPAILZBlindDateSelectCell.m
- // YOUQU
- //
- // Created by CY on 2021/12/15.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZBlindDateSelectCell.h"
- @interface YOUPAILZBlindDateSelectCell ()
- @property (nonatomic, weak) UIImageView *youpaipavatarImgV;
- @property (nonatomic,weak)UILabel *youpaipnameL;
- @property (nonatomic,weak)UILabel *youpaipseatNumL; // 座位号
- @property (nonatomic,weak) UIImageView *youpaipunmannedStateImgV; // 在没有人上麦的状态 空闲or锁定
- @end
- @implementation YOUPAILZBlindDateSelectCell
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIImageView *youpaipavatarImgV = [[UIImageView alloc] init];
- youpaipavatarImgV.layer.cornerRadius = 27.0f;
- youpaipavatarImgV.clipsToBounds = YES;
- youpaipavatarImgV.layer.borderColor = HexColorFromRGB(0xFF7FDA).CGColor;
- youpaipavatarImgV.layer.borderWidth = 0.0f;
- youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
- youpaipavatarImgV.hidden = YES;
- [self.contentView addSubview:youpaipavatarImgV];
- self.youpaipavatarImgV = youpaipavatarImgV;
- [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(0.0f);
- make.centerX.equalTo(self.contentView);
- make.size.mas_offset(CGSizeMake(54.0f, 54.0f));
- }];
-
- UIImageView *youpaipunmannedStateImgV = [[UIImageView alloc] init];
- youpaipunmannedStateImgV.hidden = YES;
- [self addSubview:youpaipunmannedStateImgV];
- self.youpaipunmannedStateImgV = youpaipunmannedStateImgV;
- [youpaipunmannedStateImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(youpaipavatarImgV);
- make.size.mas_offset(CGSizeMake(54.0f, 54.0f));
- }];
-
- UILabel *youpaipnameL = [[UILabel alloc] init];
- youpaipnameL.font = LCFont(10.0f);
- youpaipnameL.textColor = HexColorFromRGB(0x9F9DA5);
- youpaipnameL.textAlignment = NSTextAlignmentCenter;
- [self addSubview:youpaipnameL];
- self.youpaipnameL = youpaipnameL;
- [self layoutIfNeeded];
- [youpaipnameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.bottom.offset(0.0f);
- make.width.mas_lessThanOrEqualTo(self.contentView.mas_width);
- make.height.offset(13.0f);
- }];
-
- UILabel *youpaipseatNumL = [[UILabel alloc] init];
- youpaipseatNumL.font = LCFont(9.0f);
- youpaipseatNumL.textColor = [UIColor whiteColor];
- youpaipseatNumL.textAlignment = NSTextAlignmentCenter;
- youpaipseatNumL.layer.cornerRadius = 5.0f;
- youpaipseatNumL.clipsToBounds = YES;
- [youpaipnameL addSubview:youpaipseatNumL];
- self.youpaipseatNumL = youpaipseatNumL;
- [youpaipseatNumL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(0.0f);
- make.centerY.equalTo(youpaipnameL);
- make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
- }];
- }
- - (void)youpaifreloadWithModel:(YOUPAILZChatRoomSeatModel *)model{
- self.youpaipavatarImgV.hidden = YES;
- self.youpaipunmannedStateImgV.hidden = YES;
- switch (model.youpaipseatState) {
- case LZChatRoomSeatStateWithFree:{
- self.youpaipunmannedStateImgV.hidden = NO;
- NSString *imageName = @"";
- if (model.youpaipseatIndex <= 4) {
- imageName = @"vqu_image_chatroom_seat_woman";
- }else{
- imageName = @"vqu_image_chatroom_seat_man";
- }
- self.youpaipunmannedStateImgV.image = [UIImage imageNamed:imageName];
- }
- break;
- case LZChatRoomSeatStateWithLock:{
- self.youpaipunmannedStateImgV.hidden = NO;
- self.youpaipunmannedStateImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_seat_lock"];
- }
- break;
- case LZChatRoomSeatStateWithBusy:{
- self.youpaipunmannedStateImgV.hidden = YES;
- self.youpaipavatarImgV.hidden = NO;
- [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipuserInfo.youpaipavatar]];
- }
- default:
- break;
- }
-
-
- self.youpaipseatNumL.text = [NSString stringWithFormat:@"%@",@(model.youpaipseatIndex)];
- NSString *noneStr = @"";
- if (model.youpaipseatIndex <= 4) {
- noneStr = @"女神位";
- self.youpaipseatNumL.backgroundColor = HexColorFromRGB(0xFF3165);
- }else{
- noneStr = @"男神位";
- self.youpaipseatNumL.backgroundColor = HexColorFromRGB(0x368CFF);
- }
-
- NSString *nameText = @"";
- if (model.youpaipseatState == LZChatRoomSeatStateWithBusy) {
- nameText = model.youpaipuserInfo.youpaipnickname;
- }else{
- nameText = noneStr;
- }
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
- paraStyle.firstLineHeadIndent = 13.0f;//首行缩进
- NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:nameText attributes:@{NSParagraphStyleAttributeName:paraStyle}];
- self.youpaipnameL.attributedText = attrText;
-
- if (model.youpaipisSelected) {
- self.youpaipnameL.textColor = HexColorFromRGB(0xFF7FDA);
- self.youpaipavatarImgV.layer.borderWidth = 2.0f;
- }else{
- self.youpaipnameL.textColor = [UIColor whiteColor];
- self.youpaipavatarImgV.layer.borderWidth = 0.0f;
- }
- }
- @end
|