123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- //
- // YOUPAILZLiveCurrentMemberView.m
- // VQU
- //
- // Created by CY on 2021/7/22.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZLiveCurrentMemberView.h"
- @implementation YOUPAILZLiveCurrentMemberView
- - (instancetype)init{
- if (self = [super init]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UILabel *youpaiprankL = [[UILabel alloc] init];
- youpaiprankL.textColor = HexColorFromRGB(0x75170A);
- youpaiprankL.textAlignment = NSTextAlignmentCenter;
- youpaiprankL.font = LCFont14;
- [self addSubview:youpaiprankL];
- self.youpaiprankL = youpaiprankL;
- [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(7.0f);
- make.top.offset(16.0f);
- make.size.mas_offset(CGSizeMake(38.0f, 28.0f));
- }];
-
- YOUPAILZAvatarView *youpaipavatarView = [YOUPAILZAvatarView youpaifavatarViewWithFrame:CGRectMake(0, 0, 40, 40) avatarURL:nil personalityBoxURL:nil];
- [self addSubview:youpaipavatarView];
- self.youpaipavatarView = youpaipavatarView;
- [youpaipavatarView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(52.0f);
- make.top.offset(10.0f);
- make.size.mas_offset(CGSizeMake(40.0f, 40.0f));
- }];
- UILabel *youpaipnicknameL = [[UILabel alloc] init];
- youpaipnicknameL.font = LCBoldFont(14.0f);
- youpaipnicknameL.textColor = [UIColor whiteColor];
- [self addSubview:youpaipnicknameL];
- self.youpaipnicknameL = youpaipnicknameL;
- [youpaipnicknameL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
- make.top.offset(15.0f);
- }];
- UIImageView *youpaipsexV = [[UIImageView alloc] init];
- [self addSubview:youpaipsexV];
- self.youpaipsexV = youpaipsexV;
- [youpaipsexV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
- make.centerY.equalTo(youpaipnicknameL);
- make.size.mas_offset(CGSizeMake(15.0f, 15.0f));
- }];
- UIImageView *youpaipvipImgV = [[UIImageView alloc] init];
- [self addSubview:youpaipvipImgV];
- self.youpaipvipImgV = youpaipvipImgV;
- [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipsexV.mas_right).offset(3.0f);
- make.centerY.equalTo(youpaipnicknameL);
- }];
-
- YOUPAILZLevelView *youpaiplevelView = [[YOUPAILZLevelView alloc] init];
- [self addSubview:youpaiplevelView];
- self.youpaiplevelView = youpaiplevelView;
- [youpaiplevelView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipsexV.mas_right).offset(3.0f);
- make.centerY.equalTo(youpaipnicknameL);
- }];
-
- UILabel *youpaipcontributionL = [[UILabel alloc] init];
- youpaipcontributionL.font = LCFont(10.0f);
- youpaipcontributionL.textColor = [UIColor whiteColor];
- [self addSubview:youpaipcontributionL];
- self.youpaipcontributionL = youpaipcontributionL;
- [youpaipcontributionL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipavatarView.mas_right).offset(8.0f);
- make.top.equalTo(youpaipnicknameL.mas_bottom).offset(2.0f);
- }];
- UILabel *youpaiplastDifferenceL = [[UILabel alloc] init];
- youpaiplastDifferenceL.font = LCFont(12.0f);
- youpaiplastDifferenceL.textColor = [UIColor whiteColor];
- youpaiplastDifferenceL.numberOfLines = 0;
- youpaiplastDifferenceL.textAlignment = NSTextAlignmentCenter;
- [self addSubview:youpaiplastDifferenceL];
- self.youpaiplastDifferenceL = youpaiplastDifferenceL;
- [youpaiplastDifferenceL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.offset(-12.0f);
- make.centerY.equalTo(youpaipavatarView);
- }];
- }
- - (void)youpaifreloadWithModel:(YOUPAILZLiveMemberModel *)member{
- self.youpaiprankL.text = member.youpaiprank;
- self.youpaipavatarView.youpaipavatarURL = [LCTools getImageUrlWithAddress:member.youpaipavatar];
- self.youpaipavatarView.youpaippersonalityBoxURL = [LCTools getImageUrlWithAddress:member.youpaipavatar_frame];
- self.youpaipnicknameL.text = member.youpaipnickname;
- if (member.youpaipgender == 1) {//0未知 1女 2男
- self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_woman"];
- }else{
- self.youpaipsexV.image = [UIImage imageNamed:@"vqu_images_D_dynamic_man"];
- }
- self.youpaipvipImgV.hidden = YES;
- self.youpaiplevelView.hidden = YES;
-
- UIView *frontV;
-
- if (member.youpaipvip_icon.length != 0) {
- self.youpaipvipImgV.hidden = NO;
- [self.youpaipvipImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:member.youpaipvip_icon]];
- [self.youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipsexV.mas_right).offset(3.0f);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.centerY.equalTo(self.youpaipnicknameL);
- make.size.mas_offset(CGSizeMake(30.0f, 19.0f));
- }];
- frontV = self.youpaipvipImgV;
- }
-
- self.youpaiplevelView.hidden = NO;
- [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];
- [self.youpaiplevelView mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipsexV.mas_right).offset(3.0f);
- }else{
- make.left.equalTo(frontV.mas_right).offset(3.0f);
- }
- make.centerY.equalTo(self.youpaipnicknameL);
- make.size.mas_offset(self.youpaiplevelView.mj_size);
- }];
-
- self.youpaipcontributionL.attributedText = [LCTools setRichTextWithTitle:@"贡献值:" subTitle:[NSString stringWithFormat:@"%@",member.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:HexColorFromRGB(0xFFDD8D) titleFontSize:10.0f subTitleFontSize:10.0f];
- self.youpaiplastDifferenceL.text = member.youpaipgapMoney;
- }
- @end
|