123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- //
- // XYPersonalUserInfoView.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2019/12/21.
- // Copyright © 2019 翟玉磊. All rights reserved.
- //
- #import "XYPersonalUserInfoView.h"
- #import "XYUserStarLevelLabel.h"
- #import "XYUserOnlineStatusView.h"
- #import "XYNiceNumView.h"
- #import "XYUserSexAgeView.h"
- #import "YQAnmationResourceMag.h"
- #import "XYSetupViewController.h"
- #import "XYHeadWearView.h"
- @interface XYPersonalUserInfoView ()
- /// 用户头像
- @property (nonatomic, readwrite, strong) UIImageView *userAvatarImageView;
- @property (nonatomic, strong) XYHeadWearView *leftHeadWearView;
- /// 实名认证标志
- @property (nonatomic, strong) UIImageView *realAuthImageView;
- /// 官方
- @property (nonatomic, strong) UIImageView *officalImageView;
- /// 用户名字
- @property (nonatomic, readwrite, strong) UILabel *userNameLabel;
- /// 勋章
- @property (nonatomic, readwrite, strong) UIImageView *medalImageView;
- /// 用户性别
- @property (nonatomic, readwrite, strong) XYUserSexAgeView *sexAgeView;
- /// 用户等级
- @property (nonatomic, readwrite, strong) XYUserLevelLabel *userLevelLabel;
- /// 明星等级
- @property (nonatomic, strong) XYUserStarLevelLabel *starLevelLabel;
- /// 贵族徽章
- @property (nonatomic, readwrite, strong) UIImageView *nobleImageView;
- /// vip图标
- @property (nonatomic, readwrite, strong) UIImageView *vipImageView;
- /// 关注按钮
- @property (nonatomic, readwrite, strong) UIButton *followButton;
- /// 在线状态
- @property (nonatomic, strong) XYUserOnlineStatusView *onlineStatusView;
- /// 用户的ID
- @property (nonatomic, readwrite, strong) UILabel *xyNumLabel;
- /// 靓号
- @property (nonatomic, readwrite, strong) UIView *niceNumView;
- @property (nonatomic, readwrite, strong) UIImageView *niceMarkImageView;
- @property (nonatomic, readwrite, strong) UILabel *nicelNumLabel;
- @property (nonatomic, readwrite, strong) MASConstraint *niceNumViewWidthConstraint;
- @property (nonatomic, readwrite, strong) XYNiceNumView *niceNumView1;
- @property (nonatomic, readwrite, strong) UIImageView *cityImageView;
- /// 用户所在城市
- @property (nonatomic, readwrite, strong) UILabel *cityLabel;
- /// 更多标记
- @property (nonatomic, readwrite, strong) UIImageView *moreImageView;
- /// 更多标记
- @property (nonatomic, readwrite, strong) UIImageView *moreImageView1;
- /// 未登录view
- @property (nonatomic, readwrite, strong) UIView *unloginView;
- /// 未登录默认图
- @property (nonatomic, readwrite, strong) UIImageView *unloginUserImageView;
- /// 未登录标题
- @property (nonatomic, readwrite, strong) UILabel *unloginTitleLabel;
- /// 未登录按钮
- @property (nonatomic, readwrite, strong) UIButton *unloginButton;
- /// 点击按钮
- @property (nonatomic, readwrite, strong) UIButton *actionButton;
- @property (nonatomic, readwrite, strong) MASConstraint *medalImageWidthConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *medalImageHeightConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *sexImageLeftConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *sexImageWidthConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *userLevelLeftConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *userLevelWidthConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *starLevelLeftConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *starLevelWidthConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *nobleImageLeftConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *nobleImageWithConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *vipImageLeftConstraint;
- @property (nonatomic, readwrite, strong) MASConstraint *vipImageWithConstraint;
- /// 设置按钮
- @property (nonatomic, readwrite, strong) UIButton *setButton;
- @end
- @implementation XYPersonalUserInfoView
- #pragma mark - Public Method
- - (void)configureViewWithModel:(XYUserInfoModel *)model {
- if (model && [model isKindOfClass:[XYUserInfoModel class]]) {
- /// 登录状态
- self.unloginView.hidden = YES;
- self.leftHeadWearView.hidden = NO;
- [self.userAvatarImageView sd_setImageWithURL:UrlForString(model.userAvatar) placeholderImage:placeholderUserMainBgImage(model.userSex)];
- [self.leftHeadWearView setupHeadWearAnimationId:model.headWearAnimationId];
- self.realAuthImageView.hidden = !model.isAuth;
- self.userNameLabel.text = model.userName;
- UIImage *medalImage = [[YQAnmationResourceMag sharedInstance] getMetalImage:model.medal.medalId];
- if (medalImage) {
- self.medalImageView.image = medalImage;
- self.medalImageWidthConstraint.equalTo(@(medalImage.size.width/2));
- self.medalImageHeightConstraint.equalTo(@(medalImage.size.height/2));
- self.sexImageLeftConstraint.equalTo(@4.0f);
- }else {
- self.medalImageView.image = nil;
- self.medalImageWidthConstraint.equalTo(@0.0f);
- self.medalImageHeightConstraint.equalTo(@20.0f);
- self.sexImageLeftConstraint.equalTo(@0.0f);
- }
- if (model.userSex == 0) {
- [self.sexAgeView setSex:model.userSex age:model.userAge];
- self.sexImageWidthConstraint.equalTo(@0);
- self.userLevelLeftConstraint.equalTo(@0);
- }else if (model.userSex == 1) {
- [self.sexAgeView setSex:model.userSex age:model.userAge];
- self.sexImageWidthConstraint.equalTo(@32.0f);
- self.userLevelLeftConstraint.equalTo(@4.0f);
- }else if (model.userSex == 2) {
- [self.sexAgeView setSex:model.userSex age:model.userAge];
- self.sexImageWidthConstraint.equalTo(@32.0f);
- self.userLevelLeftConstraint.equalTo(@4.0f);
- }
- [self.userLevelLabel configUserLevel:model.wealthLevel shinyStatus:model.wealthMedalStatus];
- if (model.wealthLevel == 0) {
- self.userLevelWidthConstraint.equalTo(@0);
- self.starLevelLeftConstraint.equalTo(@0);
- }else {
- self.userLevelWidthConstraint.equalTo(@40);
- self.starLevelLeftConstraint.equalTo(@4);
- }
- if (model.starLevel == 0) {
- self.starLevelLabel.level = 0;
- self.starLevelWidthConstraint.equalTo(@0);
- self.nobleImageLeftConstraint.equalTo(@0);
- }else {
- self.starLevelLabel.level = model.starLevel;
- self.starLevelWidthConstraint.equalTo(@40);
- self.nobleImageLeftConstraint.equalTo(@4);
- }
-
- UIImage *nobleImage = [XYLevelImageHander getNobleImageWithLevel:model.nobleLevel];
- if (nobleImage) {
- self.nobleImageView.image = nobleImage;
- self.nobleImageWithConstraint.equalTo(@20.0f);
- self.vipImageLeftConstraint.equalTo(@4.0f);
- }else {
- self.nobleImageView.image = nil;
- self.nobleImageWithConstraint.equalTo(@0.0f);
- self.vipImageLeftConstraint.equalTo(@0.0f);
- }
- UIImage *vipImage = [UIImage imageNamed:[NSString stringWithFormat:@"xy-icon-lr-vip%ld", (long)model.vipLevel]];
- if (vipImage) {
- self.vipImageView.image = vipImage;
- self.vipImageWithConstraint.equalTo(@22.0f);
- }else {
- self.vipImageView.image = nil;
- self.vipImageWithConstraint.equalTo(@0.0f);
- }
-
- // self.xyNumLabel.text = [NSString stringWithFormat:@"%@:%@", @"ID", model.userNo];
- // if (StringIsEmpty(model.niceNo)) {
- // self.niceNumView.hidden = YES;
- // self.xyNumLabel.hidden = NO;
- // [self.cityImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(self.xyNumLabel.mas_right).offset(10.0f);
- // make.centerY.equalTo(self.xyNumLabel);
- // make.width.equalTo(@9.0f);
- // make.height.equalTo(@11.0f);
- // }];
- // }else {
- // self.niceNumView.hidden = NO;
- // self.xyNumLabel.hidden = YES;
- // NSString *text = [NSString stringWithFormat:@"%@",model.niceNo];
- // CGFloat niceNoWidth = [HandleString autoLabelWith:text withSize:CGSizeMake(MAXFLOAT, 14.0f) withFont:Font_B(10) withLines:1].width;
- // niceNoWidth += (5.0f + 5.0f);
- // self.niceMarkImageView.image = [UIImage gradientColorImageFromColors:@[ColorFromHexString(@"#FAE5AD"), ColorFromHexString(@"E0B671")] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(niceNoWidth, 20.0f)];
- // self.nicelNumLabel.text = text;
- // self.niceNumViewWidthConstraint.equalTo(@(niceNoWidth));
- // [self.cityImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.left.equalTo(self.niceNumView.mas_right).offset(10.0f);
- // make.centerY.equalTo(self.xyNumLabel);
- // make.width.equalTo(@9.0f);
- // make.height.equalTo(@11.0f);
- // }];
- // }
-
- if (!StringIsEmpty(model.niceNo) && model.niceLevel>0) {//靓号
- [self.niceNumView1 setupNum:model.niceNo andNiceLevel:model.niceLevel andIsMasory:YES andIsCopy:NO];
- }else{//普通号
- [self.niceNumView1 setupNum:model.userNo andNiceLevel:-1 andIsMasory:YES andIsCopy:NO];
- }
-
- if (StringIsNotEmpty(model.locationCity)) {
- self.cityLabel.text = model.locationCity;
- self.cityLabel.hidden = NO;
- self.cityImageView.hidden = NO;
- }else {
- self.cityLabel.hidden = YES;
- self.cityImageView.hidden = YES;
- }
-
- if (model.isOfficial == 1) {
- [self.officalImageView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@32.0f);
- }];
- [self.userNameLabel mas_updateConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.officalImageView.mas_right).offset(4.0f);
- }];
- }else {
- [self.officalImageView mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.equalTo(@0.0f);
- }];
- [self.userNameLabel mas_updateConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.officalImageView.mas_right).offset(0.0f);
- }];
- }
-
- }else {
- /// 登出状态
- self.unloginView.hidden = NO;
- self.leftHeadWearView.hidden = YES;
- }
- }
- #pragma mark - Private Method
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- // 初始化
- [self _setup];
-
- // 创建子控件
- [self _setupSubViews];
-
- // 布局子控件
- [self _makeSubViewsConstraints];
- }
- return self;
- }
- #pragma mark - 事件处理Or辅助方法
- - (void)loginActionButton:(id)sender {
- // 我的Tab,点[头像]的次数
- [StatisticsManager event:@"my_headportrait_click"];
- // 我的Tab,点[向右箭头]的次数
- [StatisticsManager event:@"my_more_click"];
- if (self.loginAction) {
- self.loginAction();
- }
- }
- - (void)setButtonAction{
- [[ApplicationDelegate getCurrentController].navigationController pushViewController:XYSetupViewController.new animated:YES];
- }
- #pragma mark - Private Method
- - (void)_setup{
-
- }
- #pragma mark - 创建子控件
- - (void)_setupSubViews{
- [self addSubview:self.userAvatarImageView];
- [self addSubview:self.realAuthImageView];
- [self addSubview:self.officalImageView];
- [self addSubview:self.userNameLabel];
- [self addSubview:self.medalImageView];
- [self addSubview:self.sexAgeView];
- [self addSubview:self.userLevelLabel];
- [self addSubview:self.starLevelLabel];
- [self addSubview:self.nobleImageView];
- [self addSubview:self.onlineStatusView];
- [self addSubview:self.vipImageView];
- [self addSubview:self.xyNumLabel];
- [self addSubview:self.niceNumView];
- [self.niceNumView addSubview:self.niceMarkImageView];
- [self.niceNumView addSubview:self.nicelNumLabel];
- [self addSubview:self.niceNumView1];
- [self addSubview:self.cityImageView];
- [self addSubview:self.cityLabel];
- [self addSubview:self.moreImageView];
- [self addSubview:self.moreImageView1];
-
- [self addSubview:self.unloginView];
- [self.unloginView addSubview:self.unloginUserImageView];
- [self.unloginView addSubview:self.unloginTitleLabel];
- [self.unloginView addSubview:self.unloginButton];
-
- [self addSubview:self.actionButton];
-
- [self.actionButton addTarget:self action:@selector(loginActionButton:) forControlEvents:UIControlEventTouchUpInside];
-
- [self setButton];
- }
- #pragma mark - 布局子控件
- - (void)_makeSubViewsConstraints{
-
- [self.userAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self).offset(16.0f);
- make.width.height.equalTo(@70.0f);
- make.centerY.equalTo(self);
- }];
- [self.realAuthImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.bottom.equalTo(self.userAvatarImageView);
- make.width.height.equalTo(@16.0f);
- }];
- [self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.userAvatarImageView.mas_right).offset(16.0f);
- make.width.equalTo(@32.0f);
- make.height.equalTo(@20.0f);
- make.centerY.equalTo(self.userNameLabel);
- }];
- [self.userNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.officalImageView.mas_right).offset(4.0f);
- make.top.equalTo(self.userAvatarImageView.mas_top).offset(-3.0f);
- make.height.equalTo(@28.0f);
- //make.right.equalTo(self.moreImageView.mas_left).offset(-10.0f);
- }];
- [self.medalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.officalImageView);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.medalImageWidthConstraint = make.width.equalTo(@32.0f);
- self.medalImageHeightConstraint = make.height.equalTo(@20.0f);
- }];
- [self.sexAgeView mas_makeConstraints:^(MASConstraintMaker *make) {
- self.sexImageLeftConstraint = make.left.equalTo(self.medalImageView.mas_right).offset(4.0f);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.sexImageWidthConstraint = make.width.equalTo(@32.0f);
- make.height.equalTo(@20.0f);
- }];
- [self.userLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- self.userLevelLeftConstraint = make.left.equalTo(self.sexAgeView.mas_right).offset(4.0f);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.userLevelWidthConstraint = make.width.equalTo(@40.0f);
- make.height.equalTo(@20.0f);
- }];
- [self.starLevelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- self.starLevelLeftConstraint = make.left.equalTo(self.userLevelLabel.mas_right).offset(4.0f);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.starLevelWidthConstraint = make.width.equalTo(@48.0f);
- make.height.equalTo(@20.0f);
- }];
- [self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- self.nobleImageLeftConstraint = make.left.equalTo(self.starLevelLabel.mas_right).offset(4.0f);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.nobleImageWithConstraint = make.width.equalTo(@20.0f);
- make.height.equalTo(@20.0f);
- }];
- [self.vipImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- self.vipImageLeftConstraint = make.left.equalTo(self.nobleImageView.mas_right).offset(4.0f);
- make.top.equalTo(self.userNameLabel.mas_bottom).offset(4.0f);
- self.vipImageWithConstraint = make.width.equalTo(@20.0f);
- make.height.equalTo(@20.0f);
- make.right.lessThanOrEqualTo(self.moreImageView.mas_left).offset(-10.0f);
- }];
- [self.onlineStatusView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.officalImageView.mas_left).offset(-10);
- make.top.equalTo(self.sexAgeView.mas_bottom).offset(6.0f);
- make.height.equalTo(@16.0f);
- make.width.equalTo(@0.0f);
- }];
- [self.xyNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
- make.top.equalTo(self.sexAgeView.mas_bottom).offset(4.0f);
- make.height.equalTo(@17.0f);
- make.right.lessThanOrEqualTo(self.moreImageView.mas_left).offset(-10.0f);
- }];
- [self.niceNumView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
- make.top.equalTo(self.sexAgeView.mas_bottom).offset(4.0f);
- self.niceNumViewWidthConstraint = make.width.equalTo(@100.0f);
- make.height.equalTo(@20.0f);
- }];
- [self.niceMarkImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.niceNumView);
- }];
- [self.nicelNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.niceNumView).offset(5.0f);
- make.right.equalTo(self.niceNumView).offset(-5.0f);
- make.centerY.equalTo(self.niceNumView);
- make.height.equalTo(@14.0f);
- }];
- [self.niceNumView1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.onlineStatusView.mas_right).offset(10.0f);
- make.centerY.equalTo(self.onlineStatusView);
- make.width.offset(10);
- make.height.offset(16);
- }];
- [self.cityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.niceNumView1.mas_right).offset(10.0f);
- make.centerY.equalTo(self.niceNumView1);
- make.width.equalTo(@9.0f);
- make.height.equalTo(@11.0f);
- }];
- [self.cityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.cityImageView.mas_right).offset(3.0f);
- make.centerY.equalTo(self.cityImageView);
- make.height.equalTo(@17.0f);
- make.right.lessThanOrEqualTo(self.moreImageView).offset(-10.0f);
- }];
- [self.moreImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self).offset(-16.0f);
- make.centerY.equalTo(self);
- make.width.equalTo(@8.0f);
- make.height.equalTo(@12.0f);
- }];
- [self.moreImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.userNameLabel.mas_right).offset(4.0f);
- make.centerY.equalTo(self.userNameLabel);
- make.width.equalTo(@6.0f);
- make.height.equalTo(@8.0f);
- }];
- [self.unloginView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.bottom.left.equalTo(self);
- make.right.equalTo(self.moreImageView.mas_left).offset(-10.0f);
- }];
- [self.unloginUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.unloginView).offset(16.0f);
- make.width.height.equalTo(@76.0f);
- make.centerY.equalTo(self.unloginView);
- }];
- [self.unloginTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.unloginUserImageView.mas_right).offset(16.0f);
- make.centerY.equalTo(self.unloginView).offset(-(9.0f + 5.0f));
- make.height.equalTo(@17.0f);
- }];
- [self.unloginButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.unloginUserImageView.mas_right).offset(16.0f);
- make.top.equalTo(self.unloginTitleLabel.mas_bottom).offset(10.0f);
- make.width.equalTo(@74.0f);
- make.height.equalTo(@26.0f);
- }];
- [self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
-
- [self.onlineStatusView addViewBorder:Color_Clear redian:8];
- [self.unloginButton addViewBorder:Color_Clear redian:13];
- [self.unloginUserImageView addViewBorder:Color_Clear redian:38];
- [self.userAvatarImageView addViewBorder:Color_Clear redian:35];
- [self.niceNumView addViewBorder:Color_Clear redian:4];
- //[self.officalImageView addViewBorder:Color_Clear redian:4];
- }
- - (UIImageView *)userAvatarImageView {
- if (!_userAvatarImageView) {
- _userAvatarImageView = [UIImageView new];
- _userAvatarImageView.image = placeholderImage();
- _userAvatarImageView.clipsToBounds = YES;
- _userAvatarImageView.contentMode = UIViewContentModeScaleAspectFill;
- }
- return _userAvatarImageView;;
- }
- - (UIImageView *)realAuthImageView {
- if (!_realAuthImageView) {
- _realAuthImageView = [UIImageView new];
- _realAuthImageView.image = ImageNamed(@"xy_user_auth_mark");
- }
- return _realAuthImageView;
- }
- - (UIImageView *)officalImageView {
- if (!_officalImageView) {
- _officalImageView = [UIImageView new];
- _officalImageView.image = ImageNamed(@"xy_official");
- }
- return _officalImageView;
- }
- - (UILabel *)userNameLabel {
- if (!_userNameLabel) {
- _userNameLabel = [UILabel createLabelTextColor:Color_White fount:Font_B(16)];
- }
- return _userNameLabel;
- }
- - (UIImageView *)medalImageView {
- if (!_medalImageView) {
- _medalImageView = [UIImageView new];
- }
- return _medalImageView;
- }
- - (XYUserSexAgeView *)sexAgeView {
- if (!_sexAgeView) {
- _sexAgeView = [XYUserSexAgeView new];
- }
- return _sexAgeView;
- }
- - (XYUserLevelLabel *)userLevelLabel {
- if (!_userLevelLabel) {
- _userLevelLabel = [XYUserLevelLabel new];
- }
- return _userLevelLabel;
- }
- - (XYUserStarLevelLabel *)starLevelLabel {
- if (!_starLevelLabel) {
- _starLevelLabel = [XYUserStarLevelLabel new];
- }
- return _starLevelLabel;
- }
- - (UIImageView *)nobleImageView {
- if (!_nobleImageView) {
- _nobleImageView = [UIImageView new];
- }
- return _nobleImageView;
- }
- - (UIImageView *)vipImageView {
- if (!_vipImageView) {
- _vipImageView = [UIImageView new];
- }
- return _vipImageView;
- }
- - (XYUserOnlineStatusView *)onlineStatusView {
- if (!_onlineStatusView) {
- _onlineStatusView = [[XYUserOnlineStatusView alloc] init];
- _onlineStatusView.status = YES;
- _onlineStatusView.hidden = YES;
- }
- return _onlineStatusView;
- }
- //- (UILabel *)xyNumLabel {
- // if (!_xyNumLabel) {
- // _xyNumLabel = [UILabel createLabelTextColor:Color_Nakaguro fount:Font(12)];
- // _xyNumLabel.tag = 10000;
- // }
- // return _xyNumLabel;
- //}
- //- (UIView *)niceNumView {
- // if (!_niceNumView) {
- // _niceNumView = [UIView new];
- // _niceNumView.hidden = YES;
- // }
- // return _niceNumView;
- //}
- //- (UIImageView *)niceMarkImageView {
- // if (!_niceMarkImageView) {
- // _niceMarkImageView = [UIImageView new];
- // }
- // return _niceMarkImageView;
- //}
- //- (UILabel *)nicelNumLabel {
- // if (!_nicelNumLabel) {
- // _nicelNumLabel = [UILabel createLabelTextColor:Color_TextFont fount:Font_B(10)];
- // _nicelNumLabel.tag = 10000;
- // }
- // return _nicelNumLabel;
- //}
- - (XYNiceNumView *)niceNumView1{
- if (_niceNumView1 == nil) {
- _niceNumView1 = [[XYNiceNumView alloc] init];
- _niceNumView1.tabPersonCenter = YES;
- }
- return _niceNumView1;
- }
- - (UIImageView *)cityImageView {
- if (!_cityImageView) {
- _cityImageView = [UIImageView new];
- _cityImageView.image = ImageNamed(@"icon_my_city");
- }
- return _cityImageView;
- }
- - (UILabel *)cityLabel {
- if (!_cityLabel) {
- _cityLabel = [UILabel createLabelTextColor:Color_White fount:Font(12)];
- }
- return _cityLabel;
- }
- - (UIImageView *)moreImageView {
- if (!_moreImageView) {
- _moreImageView = [UIImageView new];
- _moreImageView.image = ImageNamed(@"icon_my_user_more");
- _moreImageView.hidden = YES;
- }
- return _moreImageView;;
- }
- - (UIImageView *)moreImageView1 {
- if (!_moreImageView1) {
- _moreImageView1 = [UIImageView new];
- _moreImageView1.image = ImageNamed(@"icon_my_user_more");
- //_moreImageView1.hidden = YES;
- }
- return _moreImageView1;;
- }
- - (UIView *)unloginView {
- if (!_unloginView) {
- _unloginView = [UIView new];;
- _unloginView.backgroundColor = Color_White;
- }
- return _unloginView;
- }
- - (UIImageView *)unloginUserImageView {
- if (!_unloginUserImageView) {
- _unloginUserImageView = [UIImageView new];
- _unloginUserImageView.image = placeholderUserMainBgImage(1);
- }
- return _unloginUserImageView;
- }
- - (UILabel *)unloginTitleLabel {
- if (!_unloginTitleLabel) {
- _unloginTitleLabel = [UILabel createLabelTextColor:Color_TextGray fount:Font(12)];
- _unloginTitleLabel.text = @"登录订阅主播、开播当万人迷";
- }
- return _unloginTitleLabel;
- }
- - (UIButton *)unloginButton {
- if (!_unloginButton) {
- _unloginButton = [UIButton createButtonTextColor:Color_White textFont:Font(12)];
- UIImage *image = [UIImage gradientColorImageFromColors:@[ColorFromHexString(@"#5D26FF"), ColorFromHexString(@"#9059FF")] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(74.0f, 26.0f)];
- [_unloginButton setBackgroundImage:image forState:UIControlStateNormal];
- [_unloginButton setTitle:kLocalizedString(@"立即登录") forState:UIControlStateNormal];
- _unloginButton.userInteractionEnabled = NO;
- }
- return _unloginButton;
- }
- - (UIButton *)actionButton {
- if (!_actionButton) {
- _actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
- [_actionButton setBackgroundColor:Color_Clear];
- }
- return _actionButton;
- }
- - (UIButton *)setButton{
- if (_setButton == nil) {
- _setButton = [UIButton buttonWithType:UIButtonTypeCustom];
- [_setButton setImage:[UIImage imageNamed:@"icon_personal_center_set"] forState:UIControlStateNormal];
- [_setButton addTarget:self action:@selector(setButtonAction) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:_setButton];
- [_setButton mas_makeConstraints:^(MASConstraintMaker *make) {;
- make.centerY.equalTo(self.userNameLabel.mas_centerY).offset(0);
- make.right.equalTo(self.mas_right).offset(-30);
- make.width.offset(24);
- make.height.offset(24);
- }];
- }
- return _setButton;
- }
- - (UIView *)leftHeadWearView{
- if (_leftHeadWearView == nil) {
- _leftHeadWearView = [[XYHeadWearView alloc] init];
- _leftHeadWearView.backgroundColor = Color_Clear;
- [self addSubview:_leftHeadWearView];
- [_leftHeadWearView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.equalTo(self.userAvatarImageView);
- make.width.height.equalTo(@(70.0*1.34));
- }];
- _leftHeadWearView.userInteractionEnabled = NO;
- }
- return _leftHeadWearView;
- }
- @end
|