Files
peko-ios/YuMi/Modules/YMMine/View/SubViews/XPMineHeadView.m

652 lines
25 KiB
Mathematica
Raw Normal View History

2023-07-14 18:50:55 +08:00
//
// XPMineHeadView.m
// YuMi
//
// Created by YuMi on 2021/9/16.
//
#import "XPMineHeadView.h"
///Third
#import <Masonry/Masonry.h>
2023-10-28 04:46:10 +08:00
2023-07-14 18:50:55 +08:00
///Tool
#import "UIImage+Utils.h"
#import "DJDKMIMOMColor.h"
///View
#import "NetImageView.h"
#import "XPNobleCenterEntranceView.h"
#import "UIImage+Utils.h"
#import "XPMineFriendNumberView.h"
#import "XPMineAccountView.h"
#import "XPMineCenterAgencyView.h"
2023-07-14 18:50:55 +08:00
///Model
#import "UserInfoModel.h"
#import "WalletInfoModel.h"
#import "ClanDetailInfoModel.h"
2023-07-14 18:50:55 +08:00
@interface XPMineHeadView ()
///
@property (nonatomic,strong) NetImageView * avatarImageView;
///name
@property (nonatomic,strong) UIStackView *nameStackView;
2024-04-03 17:18:44 +08:00
2023-07-14 18:50:55 +08:00
///
@property (nonatomic,strong) UILabel *nameLabel;
///id
@property (nonatomic,strong) UIStackView *idStackView;
///id
@property (nonatomic,strong) UILabel *idLabel;
///
@property (nonatomic,strong) UIButton *sexImageView;
2023-08-16 15:50:27 +08:00
2023-07-14 18:50:55 +08:00
///
@property (nonatomic,strong) YYLabel *levelLabel;
@property (nonatomic,strong) NetImageView *experImageView;
@property (nonatomic,strong) NetImageView *charmImageView;
//@property (nonatomic,strong) NetImageView *nameplateImageView;
//@property (nonatomic,strong) UILabel *nameplateLabel;
2023-07-14 18:50:55 +08:00
///
@property (nonatomic,strong) UIStackView *attentionStackView;
///
@property (nonatomic,strong) XPMineFriendNumberView *attentionView;
///
@property (nonatomic,strong) XPMineFriendNumberView *fansView;
///
@property (nonatomic, strong) XPMineAccountView *accountView;
2024-04-11 15:47:44 +08:00
///VIP
2023-07-14 18:50:55 +08:00
@property (nonatomic, strong) XPNobleCenterEntranceView *nobleEntranceView;
@property (nonatomic, strong) XPMineCenterAgencyView *agencyView;
@property (nonatomic, strong) UIStackView *stackView;
2023-07-14 18:50:55 +08:00
//View
@property (nonatomic,strong) UIImageView *reviewView;
@end
@implementation XPMineHeadView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.avatarImageView];
2024-04-03 17:18:44 +08:00
2023-07-14 18:50:55 +08:00
[self addSubview:self.nameStackView];
[self addSubview:self.idStackView];
[self.nameStackView addArrangedSubview:self.nameLabel];
[self.nameStackView addArrangedSubview:self.sexImageView];
2023-07-14 18:50:55 +08:00
[self.idStackView addArrangedSubview:self.idLabel];
[self addSubview:self.levelLabel];
[self addSubview:self.attentionStackView];
[self.attentionStackView addArrangedSubview:self.attentionView];
[self.attentionStackView addArrangedSubview:self.fansView];
_stackView = [[UIStackView alloc] init];
_stackView.distribution = UIStackViewDistributionFillEqually;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.spacing = 8;
[self addSubview:_stackView];
[_stackView addArrangedSubview:self.accountView];
[_stackView addArrangedSubview:self.nobleEntranceView];
[_stackView addArrangedSubview:self.agencyView];
[self addSubview:self.experImageView];
[self addSubview:self.charmImageView];
2023-07-14 18:50:55 +08:00
[self.avatarImageView addSubview:self.reviewView];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvatarImageView)];
[self.avatarImageView addGestureRecognizer:tap];
}
- (void)initSubViewConstraints {
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(70, 70));
2023-07-14 18:50:55 +08:00
make.leading.mas_equalTo(self).offset(15);
make.top.mas_equalTo(self).offset(49 + kStatusBarHeight);
}];
[self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(12);
make.top.mas_equalTo(self.avatarImageView);//.mas_offset(4);
make.height.mas_equalTo(20);
2023-07-14 18:50:55 +08:00
}];
2023-08-16 15:50:27 +08:00
2023-07-14 18:50:55 +08:00
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.leading.mas_equalTo(self.nameStackView);
make.top.mas_equalTo(self.nameStackView.mas_bottom).offset(8);
2023-09-25 16:02:57 +08:00
make.height.mas_equalTo(18);
2023-07-14 18:50:55 +08:00
}];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(28*1.3);
make.height.mas_equalTo(14*1.3);
2023-08-16 15:50:27 +08:00
}];
2023-07-14 18:50:55 +08:00
[self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.leading.mas_equalTo(self.nameStackView);
2023-07-14 18:50:55 +08:00
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
}];
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.nameStackView);
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
make.width.mas_equalTo(0);
make.height.mas_equalTo(20);
}];
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.experImageView.mas_trailing).offset(8);
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
make.width.mas_equalTo(0);
make.height.mas_equalTo(20);
}];
2023-07-14 18:50:55 +08:00
[self.attentionStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avatarImageView.mas_bottom).mas_offset(16);
make.height.mas_equalTo(60);
make.centerX.mas_equalTo(self);
make.width.mas_equalTo(KScreenWidth);
2023-07-14 18:50:55 +08:00
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.attentionStackView.mas_bottom).mas_offset(18);
make.leading.mas_equalTo(14);
make.trailing.mas_equalTo(-14);
make.height.mas_equalTo(70);
2023-07-14 18:50:55 +08:00
}];
2023-07-14 18:50:55 +08:00
[self.reviewView mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.leading.trailing.bottom.equalTo(self.avatarImageView);
2023-07-14 18:50:55 +08:00
make.height.mas_equalTo(20);
}];
}
#pragma mark - Action
- (void)tapAvatarImageView {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadView:didClickAvatar:)]) {
[self.delegate xPMineHeadView:self didClickAvatar:self.userInfo];
}
}
///
- (void)tapFansRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpMineHeadViewClickFans)]) {
[self.delegate xpMineHeadViewClickFans];
}
}
///
- (void)tapAttentionRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpMineHeadViewClickAttention)]) {
[self.delegate xpMineHeadViewClickAttention];
}
}
///
- (void)tapAccountRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xpMineHeadViewClickAccount)]) {
[self.delegate xpMineHeadViewClickAccount];
2023-07-14 18:50:55 +08:00
}
}
2024-04-11 15:47:44 +08:00
///VIP
- (void)tapNobleCenterRecognizer {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickNobleCenter)]) {
[self.delegate xPMineHeadViewClickNobleCenter];
2023-07-14 18:50:55 +08:00
}
}
- (void)didTapAgency {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickAgency)]) {
[self.delegate xPMineHeadViewClickAgency];
}
}
2023-07-14 18:50:55 +08:00
#pragma mark - NSMutableAttributedString
-(NSInteger) getMonth:(long )time
{
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000];
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* components = [calendar components:NSCalendarUnitMonth fromDate:date];
NSInteger month = components.month;
return month;
}
- (NSInteger) getDay:(long) time
{
NSDate *date = [NSDate dateWithTimeIntervalSince1970:time/1000];
NSCalendar* calendar = [NSCalendar currentCalendar];
NSDateComponents* components = [calendar components:NSCalendarUnitDay fromDate:date];
NSInteger day = components.day;
return day;
}
///
/// @param imageUrl
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl {
NetImageConfig *config = [[NetImageConfig alloc]init];
///
config.autoLoad = YES;
NetImageView *imageView = [[NetImageView alloc] initWithUrl:imageUrl config:config];
2023-07-14 18:50:55 +08:00
UIImage* image = imageView.image;
if (image) {
CGFloat height = image.size.height > 0 ? image.size.height : 1;
CGFloat scale = image.size.width / height ;
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
} else {
NSURL *imgUrl = [NSURL URLWithString:imageUrl];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat height = myImage.size.height > 0 ? myImage.size.height : 1;
CGFloat scale = myImage.size.width / height;
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
}
imageView.layer.masksToBounds = YES;
imageView.contentMode = UIViewContentModeScaleAspectFit;
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.bounds.size.width, imageView.bounds.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
return attrString;
}
///
/// @param width
- (NSMutableAttributedString *)createSpaceAttribute:(CGFloat)width {
2023-07-14 18:50:55 +08:00
UIView *spaceView = [[UIView alloc]init];
spaceView.backgroundColor = [UIColor clearColor];
spaceView.bounds = CGRectMake(0, 0, width, 10);
NSMutableAttributedString * attribute = [NSMutableAttributedString yy_attachmentStringWithContent:spaceView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(spaceView.frame.size.width, spaceView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
return attribute;
}
///
- (NSMutableAttributedString *)createNameplateAttibuteWithImage:(NSString *)imageName{
NetImageConfig *config = [[NetImageConfig alloc]init];
///
config.autoLoad = YES;
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageName config:config];
UIImage* image = imageView.image;
if (image) {
CGFloat scale = image.size.width / (image.size.height > 0 ? image.size.height : 1);
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
} else {
NSURL *imgUrl = [NSURL URLWithString:imageName];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat scale = myImage.size.width / (myImage.size.height > 0 ? myImage.size.height : 1);
if (scale == 0) {
imageView.bounds = CGRectMake(0, 0, 60, 20);
}else {
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
}
}
imageView.contentMode = UIViewContentModeScaleAspectFit;
NSMutableAttributedString *string = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:imageView.bounds.size alignToFont:[UIFont boldSystemFontOfSize:12] alignment:YYTextVerticalAlignmentCenter];
return string;
}
2023-07-14 18:50:55 +08:00
- (NSMutableAttributedString *)createNameplateAttibute:(NSString *)tagName image:(NSString *)imageName textFont:(UIFont *)textFont {
NetImageConfig *config = [[NetImageConfig alloc]init];
///
config.autoLoad = YES;
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageName config:config];
UIImage* image = imageView.image;
if (image) {
CGFloat scale = image.size.width / (image.size.height > 0 ? image.size.height : 1);
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
} else {
NSURL *imgUrl = [NSURL URLWithString:imageName];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat scale = myImage.size.width / (myImage.size.height > 0 ? myImage.size.height : 1);
if (scale == 0) {
imageView.bounds = CGRectMake(0, 0, 60, 20);
}else {
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
}
}
imageView.contentMode = UIViewContentModeScaleAspectFit;
//
UILabel *label = [[UILabel alloc] init];
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont boldSystemFontOfSize:12];
label.adjustsFontSizeToFitWidth = YES;
label.textColor = UIColor.whiteColor;
label.text = tagName;
[imageView addSubview:label];
[label mas_makeConstraints:^(MASConstraintMaker *make) {
2024-04-11 17:05:27 +08:00
make.leading.mas_equalTo(27);
make.trailing.mas_equalTo(-8);
2023-07-14 18:50:55 +08:00
make.centerY.mas_equalTo(0);
}];
NSMutableAttributedString *string = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:imageView.bounds.size alignToFont:[UIFont boldSystemFontOfSize:12] alignment:YYTextVerticalAlignmentCenter];
return string;
}
//id
-(void)copyNameAction{
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"XPMineHeadView8")];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard. string = [NSString stringWithFormat:@"%ld", (long)_userInfo.erbanNo];
}
- (NSMutableAttributedString *)createNamePlateIdLabelAttribute:(UserInfoModel *)userInfo{
2023-07-14 18:50:55 +08:00
UIFont *font = [UIFont systemFontOfSize:14];
NSString *text = [NSString stringWithFormat:@"ID:%ld", (long)userInfo.erbanNo];
NSMutableAttributedString *textAtt = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ ",text] attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x6D6B89)}];
NSTextAttachment * attachment = [[NSTextAttachment alloc] init];
UIImage *iconImage = [UIImage imageNamed:@"user_card_copy_id1"];;
attachment.bounds = CGRectMake(0, roundf(font.capHeight - iconImage.size.height)/2.f, iconImage.size.width, iconImage.size.height);
attachment.image = iconImage;
[textAtt insertAttributedString:[NSMutableAttributedString attributedStringWithAttachment:attachment] atIndex:textAtt.length];
self.idLabel.attributedText = textAtt;
2023-07-14 18:50:55 +08:00
return textAtt;
}
2023-07-14 18:50:55 +08:00
///
- (void)createNamePlateLevelAttribute:(UserInfoModel *)userInfo {// complete:(nonnull CompletionHandler)complete{
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
if (!userInfo) {
// if(complete){
// complete(attributedString);
// }
return;
}
2023-07-14 18:50:55 +08:00
if(userInfo.isCertified == YES){
//
if (userInfo.nameplatePic.length > 0) {
[self createNameplateAttibuteWithImage:userInfo.nameplatePic];
[attributedString appendAttributedString:[self createSpaceAttribute:2]];
}
}else{
//
if (userInfo.nameplateWord.length > 0 && userInfo.nameplatePic.length>0) {
[self createNameplateAttibute:userInfo.nameplateWord image:userInfo.nameplatePic textFont:[UIFont systemFontOfSize:9]];
[attributedString appendAttributedString:[self createSpaceAttribute:2]];
}
}
// userRank
if (userInfo.userLevelVo.experUrl) {
[attributedString appendAttributedString:[self createUrlImageAttribute:userInfo.userLevelVo.experUrl]];
[attributedString appendAttributedString:[self createSpaceAttribute:2]];
}
2023-07-14 18:50:55 +08:00
//charmRank
if (userInfo.userLevelVo.charmUrl) {
[attributedString appendAttributedString:[self createUrlImageAttribute:userInfo.userLevelVo.charmUrl]];
[attributedString appendAttributedString:[self createSpaceAttribute:4]];
}
2023-07-14 18:50:55 +08:00
// if(complete){
// complete(attributedString);
// }
self.levelLabel.attributedText = attributedString;
2023-07-14 18:50:55 +08:00
}
#pragma mark - Getters And Setters
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (_userInfo) {
2023-07-14 18:50:55 +08:00
self.nameLabel.text = _userInfo.nick.length > 0 ? _userInfo.nick : @"";
self.avatarImageView.imageUrl = userInfo.avatar;
if (userInfo.isReview) {
self.reviewView.hidden = NO;
} else {
self.reviewView.hidden = YES;
self.avatarImageView.imageUrl = userInfo.avatar;
}
[self.sexImageView setTitle:[NSString getAgeWithBirth:userInfo.birth] forState:UIControlStateNormal];
self.sexImageView.hidden = NO;
self.sexImageView.backgroundColor = userInfo.gender == GenderType_Male ? UIColorFromRGB(0x6BB3FF) :UIColorFromRGB(0xFF80CC);
2023-09-26 17:57:39 +08:00
self.sexImageView.selected = _userInfo.gender != GenderType_Male;
2023-09-27 20:17:09 +08:00
self.sexImageView.titleEdgeInsets = _userInfo.gender != GenderType_Male ? UIEdgeInsetsMake(0, 2, 0, 0):UIEdgeInsetsMake(0, -1, 0, 0);
// self.levelLabel.attributedText = _userInfo.levelAtt;
2023-07-14 18:50:55 +08:00
self.fansView.number = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
self.attentionView.number = [NSString stringWithFormat:@"%ld",_userInfo.followNum];
// self.nameplateImageView.imageUrl = _userInfo.nameplatePic;
@kWeakify(self);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@kStrongify(self);
@kWeakify(self);
[self.experImageView loadImageWithUrl:self.userInfo.userLevelVo.experUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
@kStrongify(self);
self.experImageView.image = image;
CGFloat scale = 0;
if (image) {
CGFloat height = image.size.height > 0 ? image.size.height : 1;
scale = image.size.width / height ;
}
else {
NSURL *imgUrl = [NSURL URLWithString:self.userInfo.userLevelVo.experUrl];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat height = myImage.size.height > 0 ? myImage.size.height : 1;
scale = myImage.size.width / height;
}
[self.experImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20 * scale);
}];
}];
[self.charmImageView loadImageWithUrl:self.userInfo.userLevelVo.charmUrl completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) {
@kStrongify(self);
self.charmImageView.image = image;
CGFloat scale = 0;
if (image) {
CGFloat height = image.size.height > 0 ? image.size.height : 1;
scale = image.size.width / height ;
}
else {
NSURL *imgUrl = [NSURL URLWithString:self.userInfo.userLevelVo.experUrl];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat height = myImage.size.height > 0 ? myImage.size.height : 1;
scale = myImage.size.width / height;
}
[self.charmImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(20 * scale);
}];
}];
});
2023-07-14 18:50:55 +08:00
}
}
- (void)setWalletInfo:(WalletInfoModel *)walletInfo {
self.accountView.diamonds = walletInfo.diamonds;
}
- (void)setNobleInfo:(NobleCenterModel *)nobleInfo {
self.nobleEntranceView.nobleInfo = nobleInfo;
2024-04-03 21:28:30 +08:00
}
- (void)setVipInfo:(NobleInfo *)vipInfo{
_vipInfo = vipInfo;
self.nobleEntranceView.vipInfo = _vipInfo;
2023-07-14 18:50:55 +08:00
}
- (void)setClanModel:(ClanDetailMainInfoModel *)clanModel {
self.agencyView.model = clanModel;
}
2023-07-14 18:50:55 +08:00
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.userInteractionEnabled = YES;
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 35;
2023-07-14 18:50:55 +08:00
}
return _avatarImageView;
}
- (UIStackView *)nameStackView {
if (!_nameStackView) {
_nameStackView = [[UIStackView alloc] init];
_nameStackView.axis = UILayoutConstraintAxisHorizontal;
_nameStackView.distribution = UIStackViewDistributionFill;
_nameStackView.alignment = UIStackViewAlignmentLeading;
2023-07-14 18:50:55 +08:00
_nameStackView.spacing = 5;
}
return _nameStackView;
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
_nameLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:20];
2023-07-14 18:50:55 +08:00
_nameLabel.textColor = [DJDKMIMOMColor colorWithHexString:@"#1F1A4E"];
}
return _nameLabel;
}
- (UIStackView *)idStackView {
if (!_idStackView) {
_idStackView = [[UIStackView alloc] init];
_idStackView.axis = UILayoutConstraintAxisHorizontal;
_idStackView.distribution = UIStackViewDistributionFill;
_idStackView.alignment = UIStackViewAlignmentCenter;
_idStackView.spacing = 5;
}
return _idStackView;
}
- (UILabel *)idLabel {
if (!_idLabel) {
_idLabel = [[UILabel alloc] init];
_idLabel.font = [UIFont systemFontOfSize:14];
_idLabel.textColor = UIColorFromRGB(0x6D6B89);
_idLabel.userInteractionEnabled = YES;
UITapGestureRecognizer *longPress = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(copyNameAction)];
[_idLabel addGestureRecognizer:longPress];
}
return _idLabel;
}
- (UIButton *)sexImageView {
2023-07-14 18:50:55 +08:00
if (!_sexImageView) {
_sexImageView = [[UIButton alloc] init];
[_sexImageView setImage:kImage(@"home_age_boy_icon") forState:UIControlStateNormal];
[_sexImageView setImage:kImage(@"home_age_girl_icon") forState:UIControlStateSelected];
_sexImageView.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
[_sexImageView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
2023-09-27 20:17:09 +08:00
_sexImageView.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
_sexImageView.layer.cornerRadius = 14/2;
_sexImageView.layer.masksToBounds = YES;
_sexImageView.hidden = YES;
2023-07-14 18:50:55 +08:00
}
return _sexImageView;
}
- (YYLabel *)levelLabel {
if (!_levelLabel) {
_levelLabel = [[YYLabel alloc] init];
_levelLabel.preferredMaxLayoutWidth = KScreenWidth - 88;
}
return _levelLabel;
}
- (NetImageView *)experImageView {
if (!_experImageView) {
_experImageView = [[NetImageView alloc] init];
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _experImageView;
}
- (NetImageView *)charmImageView {
if (!_charmImageView) {
_charmImageView = [[NetImageView alloc] init];
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _charmImageView;
}
2023-07-14 18:50:55 +08:00
- (UIStackView *)attentionStackView {
if (!_attentionStackView) {
_attentionStackView = [[UIStackView alloc] init];
_attentionStackView.axis = UILayoutConstraintAxisHorizontal;
_attentionStackView.distribution = UIStackViewDistributionFillEqually;
_attentionStackView.alignment = UIStackViewAlignmentCenter;
2023-07-14 18:50:55 +08:00
}
return _attentionStackView;
}
- (XPMineFriendNumberView *)attentionView {
if (!_attentionView) {
_attentionView = [[XPMineFriendNumberView alloc] init];
_attentionView.title = YMLocalizedString(@"XPMineHeadView4");
_attentionView.number = @"0";
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAttentionRecognizer)];
[_attentionView addGestureRecognizer:tap];
}
return _attentionView;
}
- (XPMineFriendNumberView *)fansView {
if (!_fansView) {
_fansView = [[XPMineFriendNumberView alloc] init];
_fansView.title = YMLocalizedString(@"XPMineHeadView5");
_fansView.number = @"0";
2023-07-14 18:50:55 +08:00
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFansRecognizer)];
[_fansView addGestureRecognizer:tap];
}
return _fansView;
}
- (XPMineAccountView *)accountView {
if (!_accountView) {
_accountView = [[XPMineAccountView alloc] init];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAccountRecognizer)];
2023-07-14 18:50:55 +08:00
[_accountView addGestureRecognizer:tap];
}
return _accountView;
}
- (XPNobleCenterEntranceView *)nobleEntranceView {
if (!_nobleEntranceView) {
_nobleEntranceView = [[XPNobleCenterEntranceView alloc] init];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapNobleCenterRecognizer)];
2023-07-14 18:50:55 +08:00
[_nobleEntranceView addGestureRecognizer:tap];
}
return _nobleEntranceView;
}
- (XPMineCenterAgencyView *)agencyView {
if (!_agencyView) {
_agencyView = [[XPMineCenterAgencyView alloc] init];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAgency)];
[_agencyView addGestureRecognizer:tap];
}
return _agencyView;
}
2023-07-14 18:50:55 +08:00
- (UIImageView *)reviewView{
if (!_reviewView){
_reviewView = [UIImageView new];
_reviewView.hidden = YES;
_reviewView.image = [UIImage imageNamed:@"mine_avatar_reviewing"];
UILabel *titleView = [[UILabel alloc] init];
titleView.text = YMLocalizedString(@"XPMineHeadView7");
titleView.font = [UIFont systemFontOfSize:11 weight:UIFontWeightRegular];
titleView.textColor = [UIColor whiteColor];
titleView.textAlignment = NSTextAlignmentCenter;
[_reviewView addSubview:titleView];
[titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(_reviewView);
}];
}
return _reviewView;
}
2023-07-14 18:50:55 +08:00
@end