123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- //
- // YOUPAILZChatRoomCurrentMemberView.m
- // VQU
- //
- // Created by CY on 2021/11/8.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZChatRoomCurrentMemberView.h"
- @implementation YOUPAILZChatRoomCurrentMemberView
- - (instancetype)init{
- if (self = [super init]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UILabel *youpaiprankL = [[UILabel alloc] init];
- youpaiprankL.textColor = [UIColor whiteColor];
- youpaiprankL.textAlignment = NSTextAlignmentCenter;
- youpaiprankL.font = LCFont14;
- youpaiprankL.numberOfLines = 2;
- [self addSubview:youpaiprankL];
- self.youpaiprankL = youpaiprankL;
- [youpaiprankL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(7.0f);
- make.top.offset(11.0f);
- make.size.mas_offset(CGSizeMake(38.0f, 38.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 *youpaipvipImgV = [[UIImageView alloc] init];
- [self addSubview:youpaipvipImgV];
- self.youpaipvipImgV = youpaipvipImgV;
- [youpaipvipImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipnicknameL.mas_right).offset(3.0f);
- make.centerY.equalTo(youpaipnicknameL);
- }];
-
- UIImageView *youpaipboardImgV = [[UIImageView alloc] init];
- [self addSubview:youpaipboardImgV];
- self.youpaipboardImgV = youpaipboardImgV;
- [youpaipboardImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(youpaipnicknameL.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(youpaipnicknameL.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:(YOUPAILZChatRoomMemberModel *)member contributionName:(NSString *)contributionName{
- 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;
-
- self.youpaipvipImgV.hidden = YES;
- self.youpaipboardImgV.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_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipnicknameL.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;
- }
-
- if (member.youpaiprankInfo.youpaipimg.length != 0) {
- self.youpaipboardImgV.hidden = NO;
- [self.youpaipboardImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:member.youpaiprankInfo.youpaipimg]];
- [self.youpaipboardImgV mas_remakeConstraints:^(MASConstraintMaker *make) {
- if (frontV == nil) {
- make.left.equalTo(self.youpaipnicknameL.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(21.0f, 18.0f));
- }];
- frontV = self.youpaipboardImgV;
- }
-
- 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.youpaipnicknameL.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:[NSString stringWithFormat:@"%@:",contributionName] subTitle:[NSString stringWithFormat:@"%@",member.youpaipscore] titleColor:[UIColor whiteColor] subTitleColor:[UIColor whiteColor] titleFontSize:10.0f subTitleFontSize:12.0f];
- self.youpaiplastDifferenceL.text = member.youpaipgapMoney;
- }
- @end
|