YOUPAILZChatRoomApplySeatButton.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // YOUPAILZChatRoomApplySeatButton.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/11/6.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomApplySeatButton.h"
  9. @interface YOUPAILZChatRoomApplySeatButton ()
  10. @property (nonatomic, weak)UIImageView *youpaipbgImgV;
  11. @property (nonatomic, weak)UILabel *youpaipcountL;
  12. @property (nonatomic, weak)UILabel *youpaipdescL;
  13. @end
  14. @implementation YOUPAILZChatRoomApplySeatButton
  15. - (instancetype)initWithType:(LZChatRoomApplySeatType)type playType:(NSInteger)playType{
  16. if (self = [super init]) {
  17. [self youpaifinitUI];
  18. [self youpaifrleoadWithType:type playType:playType];
  19. }
  20. return self;
  21. }
  22. - (void)youpaifinitUI{
  23. UIImageView *youpaipbgImgV = [[UIImageView alloc] init];
  24. [self addSubview:youpaipbgImgV];
  25. self.youpaipbgImgV = youpaipbgImgV;
  26. [youpaipbgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.centerX.equalTo(self);
  28. make.top.offset(4.5f);
  29. make.size.mas_offset(CGSizeMake(34.0f, 34.0f));
  30. }];
  31. UILabel *youpaipcountL = [[UILabel alloc] init];
  32. youpaipcountL.textColor = [UIColor whiteColor];
  33. youpaipcountL.font = LCBoldFont(16.0f);
  34. youpaipcountL.text = @"0";
  35. [self addSubview:youpaipcountL];
  36. self.youpaipcountL = youpaipcountL;
  37. [youpaipcountL mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.center.equalTo(youpaipbgImgV);
  39. }];
  40. UILabel *youpaipdescL = [[UILabel alloc] init];
  41. youpaipdescL.textAlignment = NSTextAlignmentCenter;
  42. youpaipdescL.layer.cornerRadius = 7.0f;
  43. youpaipdescL.clipsToBounds = YES;
  44. youpaipdescL.font = LCFont(10.0f);
  45. youpaipdescL.backgroundColor = [UIColor whiteColor];
  46. [self addSubview:youpaipdescL];
  47. self.youpaipdescL = youpaipdescL;
  48. [youpaipdescL mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.offset(2.0f);
  50. make.right.offset(-2.0f);
  51. make.bottom.offset(-4.5f);
  52. make.height.offset(14.0f);
  53. }];
  54. }
  55. - (void)youpaifrleoadWithType:(LZChatRoomApplySeatType)type playType:(NSInteger)playType{
  56. self.youpaiptype = type;
  57. self.youpaipcountL.hidden = YES;
  58. if (playType == 2) {
  59. switch (type) {
  60. case LZChatRoomApplySeatTypeWithUpSeat:{// 我要上麦
  61. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_my_upseat_bg_blinddate"];
  62. self.youpaipdescL.text = @"我要上麦";
  63. self.youpaipdescL.textColor = HexColorFromRGB(0xFF09EA);
  64. }
  65. break;
  66. case LZChatRoomApplySeatTypeWithInline:{// 排麦中
  67. self.youpaipcountL.hidden = NO;
  68. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_in_line_bg"];
  69. self.youpaipdescL.text = @"排麦中";
  70. self.youpaipdescL.textColor = HexColorFromRGB(0x6C6B70);
  71. }
  72. break;
  73. case LZChatRoomApplySeatTypeWithApplyList:{// 申请列表
  74. self.youpaipcountL.hidden = NO;
  75. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_apply_list_bg_blinddate"];
  76. self.youpaipdescL.text = @"交友申请";
  77. self.youpaipdescL.textColor = HexColorFromRGB(0xFF09EA);
  78. }
  79. break;
  80. default:
  81. break;
  82. }
  83. }else{
  84. switch (type) {
  85. case LZChatRoomApplySeatTypeWithUpSeat:{// 我要上麦
  86. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_my_upseat_bg"];
  87. self.youpaipdescL.text = @"我要上麦";
  88. self.youpaipdescL.textColor = HexColorFromRGB(0xFF6A1F);
  89. }
  90. break;
  91. case LZChatRoomApplySeatTypeWithInline:{// 排麦中
  92. self.youpaipcountL.hidden = NO;
  93. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_in_line_bg"];
  94. self.youpaipdescL.text = @"排麦中";
  95. self.youpaipdescL.textColor = HexColorFromRGB(0x6C6B70);
  96. }
  97. break;
  98. case LZChatRoomApplySeatTypeWithApplyList:{// 申请列表
  99. self.youpaipcountL.hidden = NO;
  100. self.youpaipbgImgV.image = [UIImage imageNamed:@"vqu_images_chatroom_apply_list_bg"];
  101. self.youpaipdescL.text = @"上麦申请";
  102. self.youpaipdescL.textColor = HexColorFromRGB(0xFF6A1F);
  103. }
  104. break;
  105. default:
  106. break;
  107. }
  108. }
  109. }
  110. - (void)setYoupaipmemberCount:(NSInteger)youpaipmemberCount{
  111. if (youpaipmemberCount < 0) {
  112. youpaipmemberCount = 0;
  113. }
  114. _youpaipmemberCount = youpaipmemberCount;
  115. NSString *text = [NSString stringWithFormat:@"%@",@(youpaipmemberCount)];
  116. if (youpaipmemberCount > 99) {
  117. text = @"99+";
  118. }
  119. self.youpaipcountL.text = text;
  120. }
  121. @end