123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- //
- // YOUPAIHRSearchLiveRoomCell.m
- // VQU
- //
- // Created by xiaohaoran on 2021/11/9.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIHRSearchLiveRoomCell.h"
- #import "YYAnimatedImageView.h"
- #import "YYImage.h"
- #import "LOTAnimationView.h"
- @interface YOUPAIHRSearchLiveRoomCell ()
- @property (nonatomic, weak) LOTAnimationView *youpaipiconAnimationImgV;
- @property (nonatomic, weak) UIButton *youpaiprightBottomBtn; // 右下角
- @property(nonatomic ,strong)UILabel *youpaippeopleLabel;
- @property(nonatomic,strong)UIImageView *youpaipiconImageView;
- @property(nonatomic,strong)UILabel *youpaipnameLabel;
- @property(nonatomic,strong)UILabel *youpaiproomIDLabel;
- @property(nonatomic,strong)UIImageView *youpaiprightImageView;
- @end
- @implementation YOUPAIHRSearchLiveRoomCell
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
- [self youpaifsetSubView];
- }
- return self;
- }
- -(void)youpaifsetSubView{
- self.backgroundColor = LCBkgColor;
- //icon
- UIImageView *youpaipiconImageView = [UIImageView new];
- self.youpaipiconImageView = youpaipiconImageView;
- [self.contentView addSubview:youpaipiconImageView];
- [youpaipiconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.centerY.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(60, 60));
- }];
- youpaipiconImageView.layer.cornerRadius = 2;
- youpaipiconImageView.contentMode = UIViewContentModeScaleAspectFill;
- youpaipiconImageView.clipsToBounds = YES;
- //锁
- UIImageView *youpaiprightImageView = [UIImageView new];
- self.youpaiprightImageView = youpaiprightImageView;
- [youpaipiconImageView addSubview:youpaiprightImageView];
- [youpaiprightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.size.mas_equalTo(CGSizeMake(25, 25));
- }];
- youpaiprightImageView.contentMode = UIViewContentModeScaleAspectFill;
- youpaiprightImageView.clipsToBounds = YES;
- youpaiprightImageView.image = [UIImage imageNamed:@"vqu_images_chatroom_manager_lock"];
- youpaiprightImageView.layer.cornerRadius = 6;
- youpaiprightImageView.hidden = YES;
- //name
- UILabel *youpaipnameLabel = [UILabel new];
- self.youpaipnameLabel = youpaipnameLabel;
- [self.contentView addSubview:youpaipnameLabel];
- [youpaipnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(10);
- make.top.mas_equalTo(youpaipiconImageView).offset(12);
- }];
-
- youpaipnameLabel.textColor = [UIColor whiteColor];
- youpaipnameLabel.font = LCBoldFont(14);
- //房间号
- UILabel *youpaiproomIDLabel = [UILabel new];
- self.youpaiproomIDLabel = youpaiproomIDLabel;
- [self.contentView addSubview:youpaiproomIDLabel];
- [youpaiproomIDLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(youpaipiconImageView.mas_right).offset(10);
- make.top.mas_equalTo(youpaipnameLabel.mas_bottom).offset(10);
- }];
- youpaiproomIDLabel.textColor = HexColorFromRGB(0x9F9DA5);
- youpaiproomIDLabel.font = [UIFont systemFontOfSize:12];
- //类型
- UIButton *youpaiprightBottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- self.youpaiprightBottomBtn = youpaiprightBottomBtn;
- youpaiprightBottomBtn.frame = CGRectMake(0, 0, 56.0f, 20.0f);
- [self.contentView addSubview:youpaiprightBottomBtn];
- self.youpaiprightBottomBtn = youpaiprightBottomBtn;
- [youpaiprightBottomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-14);
- make.centerY.mas_equalTo(0);
- make.size.mas_offset(CGSizeMake(63, 20.0f));
- }];
- [youpaiprightBottomBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(63, 20) FromColors:@[HexColorFromRGB(0xFF5ADD),HexColorFromRGB(0xFF4545)] ByGradientType:1] forState:UIControlStateNormal];
- youpaiprightBottomBtn.layer.cornerRadius = 10;
- youpaiprightBottomBtn.layer.masksToBounds = YES;
-
- //人数
- UILabel *youpaippeopleLabel = [UILabel new];
- self.youpaippeopleLabel = youpaippeopleLabel;
- [youpaiprightBottomBtn addSubview:youpaippeopleLabel];
- [youpaippeopleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-5);
- make.centerY.mas_equalTo(0);
- make.width.mas_equalTo(35);
- }];
- youpaippeopleLabel.text = @"直播中";
- youpaippeopleLabel.textColor = [UIColor whiteColor];
- youpaippeopleLabel.font = [UIFont systemFontOfSize:10];
- //动画
- LOTAnimationView *youpaipiconAnimationImgV = [LOTAnimationView animationWithFilePath:[[NSBundle mainBundle] pathForResource:@"ic_chatroom_part" ofType:@"json"]];
- [youpaiprightBottomBtn addSubview:youpaipiconAnimationImgV];
- // talkingAnimationView.frame = CGRectMake(0.0f, 0.0f, self.mj_w * 1.7f, self.mj_h * 1.7f);
- youpaipiconAnimationImgV.loopAnimation = YES;
- youpaipiconAnimationImgV.contentMode = UIViewContentModeScaleAspectFill;
- [youpaipiconAnimationImgV play];
- self.youpaipiconAnimationImgV = youpaipiconAnimationImgV;
- [youpaipiconAnimationImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(youpaippeopleLabel.mas_left).offset(-4.5);
- make.centerY.equalTo(youpaippeopleLabel).offset(-2);
- make.size.mas_offset(CGSizeMake(16.0f, 14.0f));
- }];
-
- //分割线
- UIView *lineView = [UIView new];
- [self.contentView addSubview:lineView];
- [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(14);
- make.right.mas_equalTo(-14);
- make.bottom.mas_equalTo(0);
- make.height.mas_equalTo(0.5);
- }];
- lineView.backgroundColor = HexColorFromRGB(0x28262D);
- }
- -(void)setYoupaipmodel:(talkDataModel *)youpaipmodel{
- _youpaipmodel = youpaipmodel;
- if (youpaipmodel.youpaippwd == 0) {
- self.youpaiprightImageView.hidden = YES;
- }else{
- self.youpaiprightImageView.hidden = NO;
- }
- [self.youpaipiconImageView sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipcover_img] placeholderImage:nil];
- self.youpaipnameLabel.text = youpaipmodel.youpaiptitle;
- self.youpaiproomIDLabel.text = [NSString stringWithFormat:@"房间号:%ld",youpaipmodel.youpaiproom_number];
- if (youpaipmodel.youpaipparty) {
- self.youpaiprightBottomBtn.hidden = NO;
- self.youpaippeopleLabel.text = @"派对中";
- }else{
- self.youpaiprightBottomBtn.hidden = YES;
- }
-
- }
- @end
|