YOUPAILCBoardCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // YOUPAILCBoardCell.m
  3. // LiveChat
  4. //
  5. // Created by 张灿 on 2018/9/26.
  6. // Copyright © 2018年 caicai. All rights reserved.
  7. //
  8. #import "YOUPAILCBoardCell.h"
  9. @interface YOUPAILCBoardCell()
  10. @property(nonatomic,strong)UILabel* youpaipnumLabel;
  11. @property(nonatomic,strong)UILabel* youpaipnameLabel;
  12. //@property(nonatomic,strong)UILabel* valueDescLabel;
  13. @property(nonatomic,strong)UILabel* youpaipvalueLabel;
  14. @property(nonatomic,strong)UIImageView* youpaipavatarImgV;
  15. @property (nonatomic,strong)UIImageView *youpaipvipV;
  16. @end
  17. @implementation YOUPAILCBoardCell
  18. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  19. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  20. self.selectionStyle = UITableViewCellSelectionStyleNone;
  21. //v.1.5.6适配暗黑模式 动态
  22. [self.contentView setBackgroundColor:[UIColor whiteColor]];
  23. [self youpaifinitUI];
  24. }
  25. return self;
  26. }
  27. - (void)youpaifinitUI{
  28. //68 48
  29. self.youpaipnumLabel = [[UILabel alloc]init];
  30. self.youpaipnumLabel.font = LCFont(18);
  31. self.youpaipnumLabel.textColor = LCTextGray;
  32. self.youpaipnumLabel.textAlignment = NSTextAlignmentLeft;
  33. [self.contentView addSubview:self.youpaipnumLabel];
  34. [self.youpaipnumLabel makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.equalTo(self.left).offset(15);
  36. make.top.equalTo(26);
  37. make.height.equalTo(@22);
  38. }];
  39. self.youpaipavatarImgV = [[UIImageView alloc]init];
  40. self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
  41. self.youpaipavatarImgV.layer.cornerRadius = 29;
  42. self.youpaipavatarImgV.layer.masksToBounds = YES;
  43. [self.contentView addSubview:self.youpaipavatarImgV];
  44. [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.equalTo(self.left).offset(50);
  46. make.top.equalTo(8);
  47. make.size.mas_equalTo(CGSizeMake(58,58));
  48. }];
  49. self.youpaipnameLabel = [[UILabel alloc]init];
  50. self.youpaipnameLabel.font = LCFont14;
  51. self.youpaipnameLabel.textColor = HexColorFromRGB(0x333333);
  52. self.youpaipnameLabel.textAlignment = NSTextAlignmentLeft;
  53. [self.contentView addSubview:self.youpaipnameLabel];
  54. [self.youpaipnameLabel makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.equalTo(self.youpaipavatarImgV.right).offset(12);
  56. make.top.equalTo(27);
  57. make.height.equalTo(@20);
  58. }];
  59. UIImageView *vipV = [[UIImageView alloc] init];
  60. [self addSubview:vipV];
  61. self.youpaipvipV = vipV;
  62. [vipV mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.left.equalTo(self.youpaipnameLabel.mas_right).offset(5.0f);
  64. make.centerY.equalTo(self.youpaipnameLabel);
  65. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  66. }];
  67. self.youpaipvalueLabel = [[UILabel alloc]init];
  68. self.youpaipvalueLabel.font = LCFont16;
  69. self.youpaipvalueLabel.textColor = HexColorFromRGB(0xaaaaaa);
  70. self.youpaipvalueLabel.textAlignment = NSTextAlignmentRight;
  71. [self.contentView addSubview:self.youpaipvalueLabel];
  72. [self.youpaipvalueLabel makeConstraints:^(MASConstraintMaker *make) {
  73. make.right.equalTo(self.contentView.right).offset(-16);
  74. make.top.equalTo(20.5);
  75. make.height.equalTo(@19.5);
  76. }];
  77. UILabel *label = [[UILabel alloc]init];
  78. label.font = LCFont(9);
  79. label.textColor = HexColorFromRGB(0xaaaaaa);
  80. label.textAlignment = NSTextAlignmentRight;
  81. label.text = @"距离上一名差";
  82. [self.contentView addSubview:label];
  83. [label makeConstraints:^(MASConstraintMaker *make) {
  84. make.right.equalTo(self.contentView.right).offset(-16);
  85. make.bottom.equalTo(-19.5);
  86. make.height.equalTo(@12.5);
  87. }];
  88. // self.valueDescLabel = [[UILabel alloc]init];
  89. // self.valueDescLabel.font = LCFont14;
  90. // self.valueDescLabel.textColor = LCTextBlack;
  91. // self.valueDescLabel.textAlignment = NSTextAlignmentRight;
  92. // [self.contentView addSubview:self.valueDescLabel];
  93. // [self.valueDescLabel makeConstraints:^(MASConstraintMaker *make) {
  94. // make.right.equalTo(self.contentView.right).offset(-105);
  95. // make.top.equalTo(24);
  96. // make.height.equalTo(@20);
  97. // }];
  98. }
  99. - (void)setYoupaipboardModel:(YOUPAILCBoardModel *)boardModel{
  100. _youpaipboardModel = boardModel;
  101. self.youpaipnumLabel.text = [NSString stringWithFormat:@"%zd",boardModel.youpaipno];
  102. [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:boardModel.youpaipavatar]];
  103. self.youpaipnameLabel.text = boardModel.youpaipnickname;
  104. self.youpaipvalueLabel.text = boardModel.youpaipgapMoney;
  105. self.youpaipvipV.hidden = YES;
  106. if (boardModel.youpaipvip_icon.length != 0) {
  107. self.youpaipvipV.hidden = NO;
  108. [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:boardModel.youpaipvip_icon]];
  109. }
  110. // self.valueLabel.text = [LCTools integralChange:boardModel.totalMoney];
  111. // self.valueLabel.text = [NSString stringWithFormat:@"%zd",boardModel.totalMoney];
  112. // if (self.type==2) {
  113. // self.valueDescLabel.text = @"礼物值";
  114. // }else if (self.type==1){
  115. // self.valueDescLabel.text = @"财富值";
  116. // }else{
  117. // self.valueDescLabel.text = @"大咖值";
  118. // }
  119. }
  120. @end