YOUPAIZYAsylumListCell.m 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // YOUPAIZYAsylumListCell.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2020/10/10.
  6. // Copyright © 2020 leo. All rights reserved.
  7. //
  8. #import "YOUPAIZYAsylumListCell.h"
  9. @interface YOUPAIZYAsylumListCell()
  10. @property(nonatomic,strong)UIImageView *youpaipheaderImgView;
  11. @property(nonatomic,strong)UILabel *youpaipnameLabel;
  12. @property(nonatomic,strong)UILabel *youpaiptimeLabel;
  13. @property (nonatomic,strong)UILabel *youpaipnumL;
  14. @property (nonatomic,strong)UIImageView *youpaipvipV;
  15. @property (nonatomic,strong) UIImageView *youpaipsexImgV; /// 性别
  16. @property (nonatomic,strong) UIImageView *youpaipanchorTagImgV; // 女神标记
  17. @end
  18. @implementation YOUPAIZYAsylumListCell
  19. -(void)youpaifsetupUI
  20. {
  21. self.selectionStyle = UITableViewCellSelectionStyleNone;
  22. [self setBackgroundColor:[UIColor clearColor]];
  23. UILabel *numL = [[UILabel alloc]init];
  24. [numL setTextColor:[UIColor whiteColor]];
  25. numL.font = LCFont14;
  26. [self.contentView addSubview:numL];
  27. self.youpaipnumL = numL;
  28. [numL mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.offset(14.0f);
  30. make.centerY.equalTo(self.contentView.mas_centerY);
  31. }];
  32. _youpaipheaderImgView = [[UIImageView alloc] init];
  33. _youpaipheaderImgView.layer.cornerRadius = 20;
  34. _youpaipheaderImgView.layer.masksToBounds = YES;
  35. _youpaipheaderImgView.contentMode = UIViewContentModeScaleAspectFill;
  36. [self.contentView addSubview:_youpaipheaderImgView];
  37. [_youpaipheaderImgView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.offset(34.0f);
  39. make.centerY.equalTo(self.contentView.mas_centerY);
  40. make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
  41. }];
  42. UIImageView *anchorTagImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_anchor_vlog"]];
  43. anchorTagImgV.hidden = YES;
  44. [self addSubview:anchorTagImgV];
  45. self.youpaipanchorTagImgV = anchorTagImgV;
  46. [anchorTagImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.right.equalTo(self.youpaipheaderImgView.mas_right).offset(0.0f);
  48. make.bottom.equalTo(self.youpaipheaderImgView.mas_bottom).offset(0.0f);
  49. make.size.mas_offset(CGSizeMake(10.0f, 10.0f));
  50. }];
  51. _youpaipnameLabel = [[UILabel alloc]init];
  52. [_youpaipnameLabel setTextColor:[UIColor whiteColor]];
  53. _youpaipnameLabel.font = LCFont16;
  54. [self.contentView addSubview:_youpaipnameLabel];
  55. [_youpaipnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.left.equalTo(self.youpaipheaderImgView.mas_right).offset(8.0f);
  57. make.centerY.equalTo(self.contentView.mas_centerY);
  58. }];
  59. UIImageView *sexImgV = [[UIImageView alloc] init];
  60. [sexImgV setImage:[UIImage imageNamed:@"vqu_images_D_dynamic_woman"]];
  61. [self.contentView addSubview:sexImgV];
  62. self.youpaipsexImgV = sexImgV;
  63. [sexImgV makeConstraints:^(MASConstraintMaker *make) {
  64. make.left.equalTo(self.youpaipnameLabel.right).offset(@5);
  65. make.centerY.equalTo(self.youpaipnameLabel);
  66. make.size.mas_equalTo(CGSizeMake(14, 14));
  67. }];
  68. UIImageView *vipV = [[UIImageView alloc] init];
  69. [self.contentView addSubview:vipV];
  70. self.youpaipvipV = vipV;
  71. [vipV mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.left.equalTo(sexImgV.mas_right).offset(5.0f);
  73. make.centerY.equalTo(sexImgV);
  74. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  75. }];
  76. _youpaiptimeLabel = [[UILabel alloc]init];
  77. [_youpaiptimeLabel setTextColor:HexColorFromRGB(0xFF9696)];
  78. _youpaiptimeLabel.font = [UIFont systemFontOfSize:12];
  79. _youpaiptimeLabel.textAlignment = NSTextAlignmentRight;
  80. [self.contentView addSubview:_youpaiptimeLabel];
  81. [_youpaiptimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.right.offset(-14.0f);
  83. make.centerY.equalTo(self.contentView.mas_centerY);
  84. }];
  85. [self.contentView addLineWithColor:HexColorFromRGB(0x28262D) lineRect:CGRectMake(14.0f, 69.5f, KScreenWidth - 28.0f, 0.5f)];
  86. }
  87. -(void)setYoupaipmodel:(YOUPAIZYAsylumListModel *)model
  88. {
  89. [_youpaipheaderImgView sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipavatar]];
  90. _youpaipnameLabel.text = model.youpaipnickname;
  91. _youpaiptimeLabel.text = [NSString stringWithFormat:@"庇护%ld天",model.youpaiptotal_day];
  92. self.youpaipvipV.hidden = YES;
  93. if (model.youpaipvip_icon.length != 0) {
  94. self.youpaipvipV.hidden = NO;
  95. [self.youpaipvipV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipvip_icon]];
  96. }
  97. if (model.youpaipgender == 1) {//0未知 1女 2男
  98. self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"];
  99. }else{
  100. self.youpaipsexImgV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"];
  101. }
  102. }
  103. - (void)setYoupaipindexPath:(NSIndexPath *)indexPath{
  104. _youpaipindexPath = indexPath;
  105. self.youpaipnumL.text = [NSString stringWithFormat:@"%@",@(indexPath.row + 1)];
  106. }
  107. - (void)awakeFromNib {
  108. [super awakeFromNib];
  109. // Initialization code
  110. }
  111. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  112. [super setSelected:selected animated:animated];
  113. // Configure the view for the selected state
  114. }
  115. @end