YOUPAILZChatRoomBlockCell.m 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // YOUPAILZChatRoomBlockCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/11/10.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZChatRoomBlockCell.h"
  9. #import "YOUPAILZAvatarView.h"
  10. @interface YOUPAILZChatRoomBlockCell()
  11. @property (nonatomic, weak) YOUPAILZAvatarView *youpaipavatarView; // 头像
  12. @property (nonatomic, weak) UILabel *youpaipnicknameL; // 昵称
  13. @property (nonatomic, weak) UILabel *youpaiptimeL; // 剩余限制时间
  14. @property (nonatomic, weak) UIImageView *youpaipselectedImgV;
  15. @end
  16. @implementation YOUPAILZChatRoomBlockCell
  17. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  18. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. self.backgroundColor = [UIColor clearColor];
  21. [self youpaifinitUI];
  22. }
  23. return self;
  24. }
  25. - (void)youpaifinitUI{
  26. YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
  27. [self.contentView addSubview:youpaipavatarView];
  28. self.youpaipavatarView = youpaipavatarView;
  29. [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.left.offset(14.0f);
  31. make.centerY.equalTo(self.contentView.mas_centerY);
  32. make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
  33. }];
  34. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  35. youpaipnicknameL.font = LCBoldFont(14.0f);
  36. youpaipnicknameL.textColor = [UIColor whiteColor];
  37. [self.contentView addSubview:youpaipnicknameL];
  38. self.youpaipnicknameL = youpaipnicknameL;
  39. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  41. make.top.offset(18.0f);
  42. }];
  43. UILabel *youpaiptimeL = [[UILabel alloc] init];
  44. youpaiptimeL.font = LCFont(10.0f);
  45. youpaiptimeL.textColor = HexColorFromRGB(0x9F9DA5);
  46. [self.contentView addSubview:youpaiptimeL];
  47. self.youpaiptimeL = youpaiptimeL;
  48. [youpaiptimeL mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  50. make.bottom.offset(-18.0f);
  51. }];
  52. UIImageView *selectedImgV = [[UIImageView alloc] init];
  53. [self.contentView addSubview:selectedImgV];
  54. self.youpaipselectedImgV = selectedImgV;
  55. [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.centerY.equalTo(self.contentView.mas_centerY);
  57. make.right.offset(-14.0f);
  58. make.size.mas_offset(CGSizeMake(15.0f, 15.0f));
  59. }];
  60. [self.contentView addLineWithColor:HexColorFromRGB(0x4F4B5B) lineRect:CGRectMake(14.0f, 67.5f, KScreenWidth - 28.0f, 0.5f)];
  61. }
  62. -(void)youpaifreloadWithModel:(YOUPAILZChatRoomBlockModel *)model{
  63. self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:model.youpaipavatar];
  64. self.youpaipnicknameL.text = model.youpaipnickname;
  65. self.youpaiptimeL.text = model.youpaipdes;
  66. self.youpaipselectedImgV.image = model.youpaipisSelected ? [UIImage imageNamed:@"vqu_images_chatroom_black_s"] : [UIImage imageNamed:@"vqu_images_chatroom_black_n"];
  67. }
  68. @end