YOUPAIHRChatRoomHeaderCell.m 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // YOUPAIHRChatRoomHeaderCell.m
  3. // VQU
  4. //
  5. // Created by xiaohaoran on 2021/10/29.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAIHRChatRoomHeaderCell.h"
  9. @implementation YOUPAIHRChatRoomHeaderCell
  10. -(instancetype)initWithFrame:(CGRect)frame{
  11. if (self = [super initWithFrame:frame]) {
  12. [self youpaifsetSubView];
  13. }
  14. return self;
  15. }
  16. -(void)youpaifsetSubView{
  17. //头像
  18. UIImageView *youpaipavtarImgV = [[UIImageView alloc] init];
  19. self.youpaipavtarImgV = youpaipavtarImgV;
  20. [self.contentView addSubview:youpaipavtarImgV];
  21. [youpaipavtarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.edges.mas_equalTo(0);
  23. }];
  24. youpaipavtarImgV.layer.cornerRadius = 15;
  25. youpaipavtarImgV.layer.masksToBounds = YES;
  26. youpaipavtarImgV.contentMode = UIViewContentModeScaleAspectFill;
  27. //排名bg
  28. UIView *youpaipnumBgView = [UIView new];
  29. self.youpaipnumBgView = youpaipnumBgView;
  30. [self.contentView addSubview:youpaipnumBgView];
  31. [youpaipnumBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.centerX.mas_equalTo(0);
  33. make.top.mas_equalTo(youpaipavtarImgV.mas_bottom).offset(-6);
  34. make.size.mas_equalTo(CGSizeMake(12, 12));
  35. }];
  36. youpaipnumBgView.layer.cornerRadius = 6;
  37. youpaipnumBgView.layer.masksToBounds = YES;
  38. youpaipnumBgView.backgroundColor = [UIColor whiteColor];
  39. //排名
  40. UILabel *youpaipnumLabel = [UILabel new];
  41. self.youpaipnumLabel = youpaipnumLabel;
  42. [youpaipnumBgView addSubview:youpaipnumLabel];
  43. [youpaipnumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.center.mas_equalTo(0);
  45. }];
  46. youpaipnumLabel.textColor = HexColorFromRGB(0x333333);
  47. youpaipnumLabel.font = [UIFont systemFontOfSize:8];
  48. }
  49. -(void)setYoupaipmodel:(YOUPAILZChatRoomSeatModel *)youpaipmodel{
  50. _youpaipmodel = youpaipmodel;
  51. [self.youpaipavtarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:youpaipmodel.youpaipuserInfo.youpaipavatar]];
  52. self.youpaipnumLabel.text = [NSString stringWithFormat:@"%@",@(youpaipmodel.youpaipseatIndex)];
  53. if (youpaipmodel.youpaipisSelected) {
  54. self.youpaipavtarImgV.layer.borderWidth = 0.5;
  55. self.youpaipavtarImgV.layer.borderColor = HexColorFromRGB(0xFF0084).CGColor;
  56. self.youpaipnumBgView.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(12, 12) FromColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] ByGradientType:0]];
  57. self.youpaipnumLabel.textColor = [UIColor whiteColor];
  58. }else{
  59. self.youpaipavtarImgV.layer.borderWidth = 0;
  60. self.youpaipnumBgView.backgroundColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake(12, 12) FromColors:@[HexColorFromRGB(0xffffff),HexColorFromRGB(0xffffff)] ByGradientType:0]];
  61. self.youpaipnumLabel.textColor = HexColorFromRGB(0x333333);
  62. }
  63. if (youpaipmodel.youpaipseatType == LZChatRoomSeatTypeWithHost) {
  64. [self.youpaipnumBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
  65. make.centerX.mas_equalTo(0);
  66. make.top.mas_equalTo(self.youpaipavtarImgV.mas_bottom).offset(-6);
  67. make.size.mas_equalTo(CGSizeMake(23.5, 12));
  68. }];
  69. self.youpaipnumLabel.text = @"主持";
  70. }
  71. }
  72. @end