YOUPAILZLiveManageCell.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. //
  2. // YOUPAILZLiveManageCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/25.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveManageCell.h"
  9. @interface YOUPAILZLiveManageCell ()
  10. @property (nonatomic,strong) YOUPAILZLiveManageModel *youpaipmodel;
  11. @property (nonatomic,strong) NSIndexPath *youpaipindexPath;
  12. @property (nonatomic,weak) UIImageView *youpaipavatarImgV;
  13. @property (nonatomic,weak) UILabel *youpaipnicknameL;
  14. @property (nonatomic,weak) UIImageView *youpaipsexV;
  15. @end
  16. @implementation YOUPAILZLiveManageCell
  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. UIImageView *youpaipavatarImgV = [[UIImageView alloc] init];
  27. youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
  28. youpaipavatarImgV.layer.cornerRadius = 20.0f;
  29. youpaipavatarImgV.clipsToBounds = YES;
  30. youpaipavatarImgV.layer.borderWidth = 1.0f;
  31. youpaipavatarImgV.layer.borderColor = HexColorFromRGB(0x9F9DA5).CGColor;
  32. [self.contentView addSubview:youpaipavatarImgV];
  33. self.youpaipavatarImgV = youpaipavatarImgV;
  34. [youpaipavatarImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.mas_equalTo(20.0f);
  36. make.centerY.mas_equalTo(self.contentView.mas_centerY);
  37. make.size.mas_equalTo(CGSizeMake(40.0f, 40.0f));
  38. }];
  39. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  40. youpaipnicknameL.font = LCBoldFont(14.0f);
  41. youpaipnicknameL.textColor = [UIColor whiteColor];
  42. [self.contentView addSubview:youpaipnicknameL];
  43. self.youpaipnicknameL = youpaipnicknameL;
  44. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.equalTo(youpaipavatarImgV.mas_right).offset(8.0f);
  46. make.centerY.mas_equalTo(self.contentView.mas_centerY);
  47. }];
  48. UIImageView *youpaipsexV = [[UIImageView alloc] init];
  49. [self.contentView addSubview:youpaipsexV];
  50. self.youpaipsexV = youpaipsexV;
  51. [youpaipsexV mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  53. make.centerY.equalTo(youpaipnicknameL);
  54. make.size.mas_offset(CGSizeMake(15.0f, 15.0f));
  55. }];
  56. UIButton *repealBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  57. repealBtn.layer.cornerRadius = 11.0f;
  58. repealBtn.clipsToBounds = YES;
  59. [repealBtn setTitle:@"撤销" forState:UIControlStateNormal];
  60. [repealBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  61. repealBtn.titleLabel.font = LCFont12;
  62. repealBtn.backgroundColor = HexColorFromRGB(0x4F4B5B);
  63. [repealBtn addTarget:self action:@selector(youpaifrepealBtnClick) forControlEvents:UIControlEventTouchUpInside];
  64. [self.contentView addSubview:repealBtn];
  65. [repealBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.centerY.equalTo(self.contentView);
  67. make.right.offset(-14.0f);
  68. make.size.mas_offset(CGSizeMake(56.0f, 22.0f));
  69. }];
  70. }
  71. - (void)youpaifreloadWithModel:(YOUPAILZLiveManageModel *)model indexPath:(NSIndexPath *)indexPath{
  72. self.youpaipmodel = model;
  73. self.youpaipindexPath = indexPath;
  74. [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipavatar]];
  75. self.youpaipnicknameL.text = model.youpaipnickname;
  76. if (model.youpaipgender == 1) {//0未知 1女 2男
  77. self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"];
  78. }else{
  79. self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"];
  80. }
  81. }
  82. - (void)youpaifrepealBtnClick{
  83. if (self.youpaiprepealBlock != nil) {
  84. self.youpaiprepealBlock(self.youpaipmodel, self.youpaipindexPath);
  85. }
  86. }
  87. @end