YOUPAIHRSearchLiveRoomCell.m 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //
  2. // YOUPAIHRSearchLiveRoomCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/11/9.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRSearchLiveRoomCell.h"
  9. #import "YYAnimatedImageView.h"
  10. #import "YYImage.h"
  11. #import "LOTAnimationView.h"
  12. @interface YOUPAIHRSearchLiveRoomCell ()
  13. @property (nonatomic, weak) LOTAnimationView *youpaipiconAnimationImgV;
  14. @property (nonatomic, weak) UIButton *youpaiprightBottomBtn; // 右下角
  15. @property(nonatomic ,strong)UILabel *youpaippeopleLabel;
  16. @property(nonatomic,strong)UIImageView *youpaipiconImageView;
  17. @property(nonatomic,strong)UILabel *youpaipnameLabel;
  18. @property(nonatomic,strong)UILabel *youpaiproomIDLabel;
  19. @property(nonatomic,strong)UIImageView *youpaiprightImageView;
  20. @end
  21. @implementation YOUPAIHRSearchLiveRoomCell
  22. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  23. if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
  24. [self youpaifsetSubView];
  25. }
  26. return self;
  27. }
  28. -(void)youpaifsetSubView{
  29. self.backgroundColor = LCBkgColor;
  30. //icon
  31. UIImageView *youpaipiconImageView = [UIImageView new];
  32. self.youpaipiconImageView = youpaipiconImageView;
  33. [self.contentView addSubview:youpaipiconImageView];
  34. [youpaipiconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.mas_equalTo(14);
  36. make.centerY.mas_equalTo(0);
  37. make.size.mas_equalTo(CGSizeMake(60, 60));
  38. }];
  39. youpaipiconImageView.layer.cornerRadius = 2;
  40. youpaipiconImageView.contentMode = UIViewContentModeScaleAspectFill;
  41. youpaipiconImageView.clipsToBounds = YES;
  42. //锁
  43. UIImageView *youpaiprightImageView = [UIImageView new];
  44. self.youpaiprightImageView = youpaiprightImageView;
  45. [youpaipiconImageView addSubview:youpaiprightImageView];
  46. [youpaiprightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.right.mas_equalTo(0);
  48. make.top.mas_equalTo(0);
  49. make.size.mas_equalTo(CGSizeMake(25, 25));
  50. }];
  51. youpaiprightImageView.contentMode = UIViewContentModeScaleAspectFill;
  52. youpaiprightImageView.clipsToBounds = YES;
  53. youpaiprightImageView.image = [UIImage imageNamed:@"vqu_images_chatroom_manager_lock"];
  54. youpaiprightImageView.layer.cornerRadius = 6;
  55. youpaiprightImageView.hidden = YES;
  56. //name
  57. UILabel *youpaipnameLabel = [UILabel new];
  58. self.youpaipnameLabel = youpaipnameLabel;
  59. [self.contentView addSubview:youpaipnameLabel];
  60. [youpaipnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(10);
  62. make.top.mas_equalTo(youpaipiconImageView).offset(12);
  63. }];
  64. youpaipnameLabel.textColor = [UIColor whiteColor];
  65. youpaipnameLabel.font = LCBoldFont(14);
  66. //房间号
  67. UILabel *youpaiproomIDLabel = [UILabel new];
  68. self.youpaiproomIDLabel = youpaiproomIDLabel;
  69. [self.contentView addSubview:youpaiproomIDLabel];
  70. [youpaiproomIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(10);
  72. make.top.mas_equalTo(youpaipnameLabel.mas_bottom).offset(10);
  73. }];
  74. youpaiproomIDLabel.textColor = HexColorFromRGB(0x9F9DA5);
  75. youpaiproomIDLabel.font = [UIFont systemFontOfSize:12];
  76. //类型
  77. UIButton *youpaiprightBottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  78. self.youpaiprightBottomBtn = youpaiprightBottomBtn;
  79. youpaiprightBottomBtn.frame = CGRectMake(0, 0, 56.0f, 20.0f);
  80. [self.contentView addSubview:youpaiprightBottomBtn];
  81. self.youpaiprightBottomBtn = youpaiprightBottomBtn;
  82. [youpaiprightBottomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.right.offset(-14);
  84. make.centerY.mas_equalTo(0);
  85. make.size.mas_offset(CGSizeMake(63, 20.0f));
  86. }];
  87. [youpaiprightBottomBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(63, 20) FromColors:@[HexColorFromRGB(0xFF5ADD),HexColorFromRGB(0xFF4545)] ByGradientType:1] forState:UIControlStateNormal];
  88. youpaiprightBottomBtn.layer.cornerRadius = 10;
  89. youpaiprightBottomBtn.layer.masksToBounds = YES;
  90. //人数
  91. UILabel *youpaippeopleLabel = [UILabel new];
  92. self.youpaippeopleLabel = youpaippeopleLabel;
  93. [youpaiprightBottomBtn addSubview:youpaippeopleLabel];
  94. [youpaippeopleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.right.mas_equalTo(-5);
  96. make.centerY.mas_equalTo(0);
  97. make.width.mas_equalTo(35);
  98. }];
  99. youpaippeopleLabel.text = @"直播中";
  100. youpaippeopleLabel.textColor = [UIColor whiteColor];
  101. youpaippeopleLabel.font = [UIFont systemFontOfSize:10];
  102. //动画
  103. LOTAnimationView *youpaipiconAnimationImgV = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:@"ic_chatroom_part" ofType:@"json"]];
  104. [youpaiprightBottomBtn addSubview:youpaipiconAnimationImgV];
  105. // talkingAnimationView.frame = CGRectMake(0.0f, 0.0f, self.mj_w * 1.7f, self.mj_h * 1.7f);
  106. youpaipiconAnimationImgV.loopAnimation = YES;
  107. youpaipiconAnimationImgV.contentMode = UIViewContentModeScaleAspectFill;
  108. [youpaipiconAnimationImgV play];
  109. self.youpaipiconAnimationImgV = youpaipiconAnimationImgV;
  110. [youpaipiconAnimationImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  111. make.right.mas_equalTo(youpaippeopleLabel.mas_left).offset(-4.5);
  112. make.centerY.equalTo(youpaippeopleLabel).offset(-2);
  113. make.size.mas_offset(CGSizeMake(16.0f, 14.0f));
  114. }];
  115. //分割线
  116. UIView *lineView = [UIView new];
  117. [self.contentView addSubview:lineView];
  118. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.left.mas_equalTo(14);
  120. make.right.mas_equalTo(-14);
  121. make.bottom.mas_equalTo(0);
  122. make.height.mas_equalTo(0.5);
  123. }];
  124. lineView.backgroundColor = HexColorFromRGB(0x28262D);
  125. }
  126. -(void)setYoupaipmodel:(talkDataModel *)youpaipmodel{
  127. _youpaipmodel = youpaipmodel;
  128. if (youpaipmodel.youpaippwd == 0) {
  129. self.youpaiprightImageView.hidden = YES;
  130. }else{
  131. self.youpaiprightImageView.hidden = NO;
  132. }
  133. [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipcover_img] placeholderImage:nil];
  134. self.youpaipnameLabel.text = youpaipmodel.youpaiptitle;
  135. self.youpaiproomIDLabel.text = [NSString stringWithFormat:@"房间号:%ld",youpaipmodel.youpaiproom_number];
  136. if (youpaipmodel.youpaipparty) {
  137. self.youpaiprightBottomBtn.hidden = NO;
  138. self.youpaippeopleLabel.text = @"派对中";
  139. }else{
  140. self.youpaiprightBottomBtn.hidden = YES;
  141. }
  142. }
  143. @end