1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // YOUPAIHRChatRoomHeaderCell.m
- // VQU
- //
- // Created by xiaohaoran on 2021/10/29.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIHRChatRoomHeaderCell.h"
- @implementation YOUPAIHRChatRoomHeaderCell
- -(instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- [self youpaifsetSubView];
- }
- return self;
- }
- -(void)youpaifsetSubView{
-
- //头像
- UIImageView *youpaipavtarImgV = [[UIImageView alloc] init];
- self.youpaipavtarImgV = youpaipavtarImgV;
- [self.contentView addSubview:youpaipavtarImgV];
- [youpaipavtarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.mas_equalTo(0);
- }];
- youpaipavtarImgV.layer.cornerRadius = 15;
- youpaipavtarImgV.layer.masksToBounds = YES;
- youpaipavtarImgV.contentMode = UIViewContentModeScaleAspectFill;
-
- //排名bg
- UIView *youpaipnumBgView = [UIView new];
- self.youpaipnumBgView = youpaipnumBgView;
- [self.contentView addSubview:youpaipnumBgView];
- [youpaipnumBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.top.mas_equalTo(youpaipavtarImgV.mas_bottom).offset(-6);
- make.size.mas_equalTo(CGSizeMake(12, 12));
- }];
- youpaipnumBgView.layer.cornerRadius = 6;
- youpaipnumBgView.layer.masksToBounds = YES;
- youpaipnumBgView.backgroundColor = [UIColor whiteColor];
- //排名
- UILabel *youpaipnumLabel = [UILabel new];
- self.youpaipnumLabel = youpaipnumLabel;
- [youpaipnumBgView addSubview:youpaipnumLabel];
- [youpaipnumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(0);
- }];
- youpaipnumLabel.textColor = HexColorFromRGB(0x333333);
- youpaipnumLabel.font = [UIFont systemFontOfSize:8];
-
- }
- -(void)setYoupaipmodel:(YOUPAILZChatRoomSeatModel *)youpaipmodel{
- _youpaipmodel = youpaipmodel;
- [self.youpaipavtarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipuserInfo.youpaipavatar]];
- self.youpaipnumLabel.text = [NSString stringWithFormat:@"%@",@(youpaipmodel.youpaipseatIndex)];
- if (youpaipmodel.youpaipisSelected) {
- self.youpaipavtarImgV.layer.borderWidth = 0.5;
- self.youpaipavtarImgV.layer.borderColor = HexColorFromRGB(0xFF0084).CGColor;
- self.youpaipnumBgView.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(12, 12) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:0]];
- self.youpaipnumLabel.textColor = [UIColor whiteColor];
- }else{
- self.youpaipavtarImgV.layer.borderWidth = 0;
- self.youpaipnumBgView.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(12, 12) FromColors:@[HexColorFromRGB(0xffffff),HexColorFromRGB(0xffffff)] ByGradientType:0]];
- self.youpaipnumLabel.textColor = HexColorFromRGB(0x333333);
- }
- if (youpaipmodel.youpaipseatType == LZChatRoomSeatTypeWithHost) {
- [self.youpaipnumBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.top.mas_equalTo(self.youpaipavtarImgV.mas_bottom).offset(-6);
- make.size.mas_equalTo(CGSizeMake(23.5, 12));
- }];
- self.youpaipnumLabel.text = @"主持";
- }
- }
- @end
|