YOUPAILZLiveAnchorHotMemberView.m 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // YOUPAILZLiveAnchorHotMemberView.m
  3. // VQU
  4. //
  5. // Created by 肖浩然的mac on 2021/7/23.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveAnchorHotMemberView.h"
  9. @implementation YOUPAILZLiveAnchorHotMemberView
  10. - (instancetype)init{
  11. if (self = [super init]) {
  12. [self youpaifinitUI];
  13. }
  14. return self;
  15. }
  16. - (void)youpaifinitUI{
  17. UILabel *youpaiprankL = [[UILabel alloc] init];
  18. youpaiprankL.textColor = [UIColor whiteColor];
  19. youpaiprankL.textAlignment = NSTextAlignmentCenter;
  20. youpaiprankL.font = LCFont14;
  21. [self addSubview:youpaiprankL];
  22. self.youpaiprankL = youpaiprankL;
  23. [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.offset(7.0f);
  25. make.top.offset(16.0f);
  26. make.size.mas_offset(CGSizeMake(38.0f, 28.0f));
  27. }];
  28. YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
  29. [self addSubview:youpaipavatarView];
  30. self.youpaipavatarView = youpaipavatarView;
  31. [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.offset(52.0f);
  33. make.top.offset(10.0f);
  34. make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
  35. }];
  36. UILabel *youpaipnicknameL = [[UILabel alloc] init];
  37. youpaipnicknameL.font = LCBoldFont(14.0f);
  38. youpaipnicknameL.textColor = [UIColor whiteColor];
  39. [self addSubview:youpaipnicknameL];
  40. self.youpaipnicknameL = youpaipnicknameL;
  41. [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  43. make.top.offset(15.0f);
  44. }];
  45. UIImageView *youpaipsexV = [[UIImageView alloc] init];
  46. [self addSubview:youpaipsexV];
  47. self.youpaipsexV = youpaipsexV;
  48. [youpaipsexV mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
  50. make.centerY.equalTo(youpaipnicknameL);
  51. make.size.mas_offset(CGSizeMake(15.0f, 15.0f));
  52. }];
  53. UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
  54. [self addSubview:youpaipvipImgV];
  55. self.youpaipvipImgV = youpaipvipImgV;
  56. [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.equalTo(youpaipsexV.mas_right).offset(3.0f);
  58. make.centerY.equalTo(youpaipnicknameL);
  59. }];
  60. YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
  61. [self addSubview:youpaiplevelView];
  62. self.youpaiplevelView = youpaiplevelView;
  63. [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.left.equalTo(youpaipsexV.mas_right).offset(3.0f);
  65. make.centerY.equalTo(youpaipnicknameL);
  66. }];
  67. UILabel *youpaipcontributionL = [[UILabel alloc] init];
  68. youpaipcontributionL.font = LCFont(10.0f);
  69. youpaipcontributionL.textColor = [UIColor whiteColor];
  70. [self addSubview:youpaipcontributionL];
  71. self.youpaipcontributionL = youpaipcontributionL;
  72. [youpaipcontributionL mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
  74. make.top.equalTo(youpaipnicknameL.mas_bottom).offset(2.0f);
  75. }];
  76. UILabel *youpaiplastDifferenceL = [[UILabel alloc] init];
  77. youpaiplastDifferenceL.font = LCFont(12.0f);
  78. youpaiplastDifferenceL.textColor = [UIColor whiteColor];
  79. youpaiplastDifferenceL.numberOfLines = 0;
  80. youpaiplastDifferenceL.textAlignment = NSTextAlignmentCenter;
  81. [self addSubview:youpaiplastDifferenceL];
  82. self.youpaiplastDifferenceL = youpaiplastDifferenceL;
  83. [youpaiplastDifferenceL mas_makeConstraints:^(MASConstraintMaker *make) {
  84. make.right.offset(-12.0f);
  85. make.centerY.equalTo(youpaipavatarView);
  86. }];
  87. }
  88. - (void)youpaifreloadWithModel:(YOUPAILZLiveCurrent_anchorModel *)member{
  89. self.youpaiprankL.text = [NSString stringWithFormat:@"%ld",member.youpaiprank];
  90. self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:member.youpaipavatar];
  91. self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:member.youpaipavatar_frame];
  92. self.youpaipnicknameL.text = member.youpaipnickname;
  93. if (member.youpaipgender == 1) {//0未知 1女 2男
  94. self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"];
  95. }else{
  96. self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"];
  97. }
  98. self.youpaipvipImgV.hidden = YES;
  99. self.youpaiplevelView.hidden = YES;
  100. UIView *frontV;
  101. if (member.youpaipvip_icon.length != 0) {
  102. self.youpaipvipImgV.hidden = NO;
  103. [self.youpaipvipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:member.youpaipvip_icon]];
  104. [self.youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  105. if (frontV == nil) {
  106. make.left.equalTo(self.youpaipsexV.mas_right).offset(3.0f);
  107. }else{
  108. make.left.equalTo(frontV.mas_right).offset(3.0f);
  109. }
  110. make.centerY.equalTo(self.youpaipnicknameL);
  111. make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
  112. }];
  113. frontV = self.youpaipvipImgV;
  114. }
  115. self.youpaiplevelView.hidden = NO;
  116. [self.youpaiplevelView youpaifreloadWithIcon:member.youpaipgrade.youpaipimg1 iconWidth:member.youpaipgrade.youpaipicon_width bgImg:member.youpaipgrade.youpaipimg2 bgImgWidth:member.youpaipgrade.youpaipicon1_width levelName:member.youpaipgrade.youpaipgrade_name level:member.youpaipgrade.youpaipgrade];
  117. [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
  118. if (frontV == nil) {
  119. make.left.equalTo(self.youpaipsexV.mas_right).offset(3.0f);
  120. }else{
  121. make.left.equalTo(frontV.mas_right).offset(3.0f);
  122. }
  123. make.centerY.equalTo(self.youpaipnicknameL);
  124. make.size.mas_offset(self.youpaiplevelView.mj_size);
  125. }];
  126. self.youpaipcontributionL.attributedText = [LCTools setRichTextWithTitle:@"魅力值:" subTitle:[NSString stringWithFormat:@"%@",member.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFDD8D) titleFontSize:10.0f subTitleFontSize:10.0f];
  127. self.youpaiplastDifferenceL.text = member.youpaipgapMoney;
  128. }
  129. @end