123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- //
- // YOUPAILZChatRoomApplySeatButton.m
- // VQU
- //
- // Created by CY on 2021/11/6.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomApplySeatButton.h"
- @interface YOUPAILZChatRoomApplySeatButton ()
- @property (nonatomic, weak)UIImageView *youpaipbgImgV;
- @property (nonatomic, weak)UILabel *youpaipcountL;
- @property (nonatomic, weak)UILabel *youpaipdescL;
- @end
- @implementation YOUPAILZChatRoomApplySeatButton
- - (instancetype)initWithType:(LZChatRoomApplySeatType)type playType:(NSInteger)playType{
- if (self = [super init]) {
- [self youpaifinitUI];
- [self youpaifrleoadWithType:type playType:playType];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIImageView *youpaipbgImgV = [[UIImageView alloc] init];
- [self addSubview:youpaipbgImgV];
- self.youpaipbgImgV = youpaipbgImgV;
- [youpaipbgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.offset(4.5f);
- make.size.mas_offset(CGSizeMake(34.0f, 34.0f));
- }];
-
- UILabel *youpaipcountL = [[UILabel alloc] init];
- youpaipcountL.textColor = [UIColor whiteColor];
- youpaipcountL.font = LCBoldFont(16.0f);
- youpaipcountL.text = @"0";
- [self addSubview:youpaipcountL];
- self.youpaipcountL = youpaipcountL;
- [youpaipcountL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(youpaipbgImgV);
- }];
-
- UILabel *youpaipdescL = [[UILabel alloc] init];
- youpaipdescL.textAlignment = NSTextAlignmentCenter;
- youpaipdescL.layer.cornerRadius = 7.0f;
- youpaipdescL.clipsToBounds = YES;
- youpaipdescL.font = LCFont(10.0f);
- youpaipdescL.backgroundColor = [UIColor whiteColor];
- [self addSubview:youpaipdescL];
- self.youpaipdescL = youpaipdescL;
- [youpaipdescL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(2.0f);
- make.right.offset(-2.0f);
- make.bottom.offset(-4.5f);
- make.height.offset(14.0f);
- }];
- }
- - (void)youpaifrleoadWithType:(LZChatRoomApplySeatType)type playType:(NSInteger)playType{
- self.youpaiptype = type;
- self.youpaipcountL.hidden = YES;
- if (playType == 2) {
- switch (type) {
- case LZChatRoomApplySeatTypeWithUpSeat:{// 我要上麦
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_my_upseat_bg_blinddate"];
- self.youpaipdescL.text = @"我要上麦";
- self.youpaipdescL.textColor = HexColorFromRGB(0xFF09EA);
- }
- break;
- case LZChatRoomApplySeatTypeWithInline:{// 排麦中
- self.youpaipcountL.hidden = NO;
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_in_line_bg"];
- self.youpaipdescL.text = @"排麦中";
- self.youpaipdescL.textColor = HexColorFromRGB(0x6C6B70);
-
- }
- break;
- case LZChatRoomApplySeatTypeWithApplyList:{// 申请列表
- self.youpaipcountL.hidden = NO;
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_apply_list_bg_blinddate"];
- self.youpaipdescL.text = @"交友申请";
- self.youpaipdescL.textColor = HexColorFromRGB(0xFF09EA);
- }
- break;
- default:
- break;
- }
- }else{
- switch (type) {
- case LZChatRoomApplySeatTypeWithUpSeat:{// 我要上麦
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_my_upseat_bg"];
- self.youpaipdescL.text = @"我要上麦";
- self.youpaipdescL.textColor = HexColorFromRGB(0xFF6A1F);
- }
- break;
- case LZChatRoomApplySeatTypeWithInline:{// 排麦中
- self.youpaipcountL.hidden = NO;
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_in_line_bg"];
- self.youpaipdescL.text = @"排麦中";
- self.youpaipdescL.textColor = HexColorFromRGB(0x6C6B70);
-
- }
- break;
- case LZChatRoomApplySeatTypeWithApplyList:{// 申请列表
- self.youpaipcountL.hidden = NO;
- self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_apply_list_bg"];
- self.youpaipdescL.text = @"上麦申请";
- self.youpaipdescL.textColor = HexColorFromRGB(0xFF6A1F);
- }
- break;
- default:
- break;
- }
- }
-
- }
- - (void)setYoupaipmemberCount:(NSInteger)youpaipmemberCount{
- if (youpaipmemberCount < 0) {
- youpaipmemberCount = 0;
- }
- _youpaipmemberCount = youpaipmemberCount;
- NSString *text = [NSString stringWithFormat:@"%@",@(youpaipmemberCount)];
- if (youpaipmemberCount > 99) {
- text = @"99+";
- }
- self.youpaipcountL.text = text;
- }
- @end
|