566 lines
21 KiB
Objective-C
566 lines
21 KiB
Objective-C
//
|
|
// XPMineHeadView.m
|
|
// YuMi
|
|
//
|
|
// Created by YuMi on 2021/9/16.
|
|
//
|
|
|
|
#import "XPMineHeadView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
|
|
///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"
|
|
///Model
|
|
#import "UserInfoModel.h"
|
|
#import "WalletInfoModel.h"
|
|
#import "ClanDetailInfoModel.h"
|
|
|
|
@interface XPMineHeadView ()
|
|
///头像
|
|
@property (nonatomic,strong) NetImageView * avatarImageView;
|
|
///name的容器
|
|
@property (nonatomic,strong) UIStackView *nameStackView;
|
|
|
|
///名字
|
|
@property (nonatomic,strong) UILabel *nameLabel;
|
|
///id 的容器
|
|
@property (nonatomic,strong) UIStackView *idStackView;
|
|
///id
|
|
@property (nonatomic,strong) UILabel *idLabel;
|
|
///性别
|
|
@property (nonatomic,strong) UIButton *sexImageView;
|
|
|
|
///显示等级
|
|
@property (nonatomic,strong) YYLabel *levelLabel;
|
|
///关注、粉丝的容器
|
|
@property (nonatomic,strong) UIStackView *attentionStackView;
|
|
///关注
|
|
@property (nonatomic,strong) XPMineFriendNumberView *attentionView;
|
|
///粉丝
|
|
@property (nonatomic,strong) XPMineFriendNumberView *fansView;
|
|
///账户中心
|
|
@property (nonatomic, strong) XPMineAccountView *accountView;
|
|
///VIP中心
|
|
@property (nonatomic, strong) XPNobleCenterEntranceView *nobleEntranceView;
|
|
|
|
@property (nonatomic, strong) XPMineCenterAgencyView *agencyView;
|
|
|
|
@property (nonatomic, strong) UIStackView *stackView;
|
|
|
|
//审核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];
|
|
|
|
[self addSubview:self.nameStackView];
|
|
[self addSubview:self.idStackView];
|
|
[self.nameStackView addArrangedSubview:self.nameLabel];
|
|
[self.nameStackView addArrangedSubview:self.sexImageView];
|
|
[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.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));
|
|
make.leading.mas_equalTo(self).offset(15);
|
|
make.top.mas_equalTo(self).offset(49 + kStatusBarHeight);
|
|
}];
|
|
|
|
[self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(12);
|
|
make.top.mas_equalTo(self.avatarImageView);//.mas_offset(4);
|
|
make.height.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.nameStackView);
|
|
make.top.mas_equalTo(self.nameStackView.mas_bottom).offset(8);
|
|
make.height.mas_equalTo(18);
|
|
}];
|
|
|
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(28*1.3);
|
|
make.height.mas_equalTo(14*1.3);
|
|
}];
|
|
[self.levelLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.mas_equalTo(self.nameStackView);
|
|
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
|
|
}];
|
|
|
|
[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);
|
|
}];
|
|
|
|
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.attentionStackView.mas_bottom).mas_offset(18);
|
|
make.left.mas_equalTo(14);
|
|
make.right.mas_equalTo(-14);
|
|
make.height.mas_equalTo(70);
|
|
}];
|
|
|
|
[self.reviewView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.leading.trailing.bottom.equalTo(self.avatarImageView);
|
|
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];
|
|
}
|
|
}
|
|
///VIP中心
|
|
- (void)tapNobleCenterRecognizer {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickNobleCenter)]) {
|
|
[self.delegate xPMineHeadViewClickNobleCenter];
|
|
}
|
|
}
|
|
|
|
- (void)didTapAgency {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadViewClickAgency)]) {
|
|
[self.delegate xPMineHeadViewClickAgency];
|
|
}
|
|
}
|
|
|
|
#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];
|
|
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 {
|
|
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;
|
|
}
|
|
- (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) {
|
|
make.leading.mas_equalTo(27);
|
|
make.trailing.mas_equalTo(-8);
|
|
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{
|
|
|
|
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];
|
|
return textAtt;
|
|
}
|
|
|
|
///当装扮铭牌时,我的页面中不需要显示铭牌标识
|
|
- (void)createNamePlateLevelAttribute:(UserInfoModel *)userInfo complete:(nonnull CompletionHandler)complete{
|
|
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] init];
|
|
if (!userInfo) {
|
|
if(complete){
|
|
complete(attributedString);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 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]];
|
|
}
|
|
|
|
//charmRank 魅力等级
|
|
if (userInfo.userLevelVo.charmUrl) {
|
|
[attributedString appendAttributedString:[self createUrlImageAttribute:userInfo.userLevelVo.charmUrl]];
|
|
[attributedString appendAttributedString:[self createSpaceAttribute:4]];
|
|
}
|
|
|
|
if(complete){
|
|
complete(attributedString);
|
|
}
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (void)setUserInfo:(UserInfoModel *)userInfo {
|
|
_userInfo = userInfo;
|
|
if (_userInfo) {
|
|
self.idLabel.attributedText = userInfo.idAtt;
|
|
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);
|
|
self.sexImageView.selected = _userInfo.gender != GenderType_Male;
|
|
self.sexImageView.titleEdgeInsets = _userInfo.gender != GenderType_Male ? UIEdgeInsetsMake(0, 2, 0, 0):UIEdgeInsetsMake(0, -1, 0, 0);
|
|
|
|
self.levelLabel.attributedText = _userInfo.levelAtt;
|
|
|
|
self.fansView.number = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
|
|
self.attentionView.number = [NSString stringWithFormat:@"%ld",_userInfo.followNum];
|
|
}
|
|
}
|
|
|
|
- (void)setWalletInfo:(WalletInfoModel *)walletInfo {
|
|
self.accountView.diamonds = walletInfo.diamonds;
|
|
}
|
|
- (void)setNobleInfo:(NobleCenterModel *)nobleInfo {
|
|
self.nobleEntranceView.nobleInfo = nobleInfo;
|
|
}
|
|
- (void)setVipInfo:(NobleInfo *)vipInfo{
|
|
_vipInfo = vipInfo;
|
|
self.nobleEntranceView.vipInfo = _vipInfo;
|
|
}
|
|
|
|
- (void)setClanModel:(ClanDetailMainInfoModel *)clanModel {
|
|
self.agencyView.model = clanModel;
|
|
}
|
|
|
|
- (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;
|
|
}
|
|
return _avatarImageView;
|
|
}
|
|
|
|
- (UIStackView *)nameStackView {
|
|
if (!_nameStackView) {
|
|
_nameStackView = [[UIStackView alloc] init];
|
|
_nameStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
_nameStackView.distribution = UIStackViewDistributionFill;
|
|
_nameStackView.alignment = UIStackViewAlignmentLeading;
|
|
_nameStackView.spacing = 5;
|
|
}
|
|
return _nameStackView;
|
|
}
|
|
|
|
- (UILabel *)nameLabel {
|
|
if (!_nameLabel) {
|
|
_nameLabel = [[UILabel alloc] init];
|
|
_nameLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:20];
|
|
_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 {
|
|
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];
|
|
_sexImageView.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
|
|
_sexImageView.layer.cornerRadius = 14/2;
|
|
_sexImageView.layer.masksToBounds = YES;
|
|
_sexImageView.hidden = YES;
|
|
|
|
}
|
|
return _sexImageView;
|
|
}
|
|
|
|
- (YYLabel *)levelLabel {
|
|
if (!_levelLabel) {
|
|
_levelLabel = [[YYLabel alloc] init];
|
|
_levelLabel.preferredMaxLayoutWidth = KScreenWidth - 88;
|
|
}
|
|
return _levelLabel;
|
|
}
|
|
|
|
- (UIStackView *)attentionStackView {
|
|
if (!_attentionStackView) {
|
|
_attentionStackView = [[UIStackView alloc] init];
|
|
_attentionStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
_attentionStackView.distribution = UIStackViewDistributionFillEqually;
|
|
_attentionStackView.alignment = UIStackViewAlignmentCenter;
|
|
}
|
|
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";
|
|
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)];
|
|
[_accountView addGestureRecognizer:tap];
|
|
}
|
|
return _accountView;
|
|
}
|
|
- (XPNobleCenterEntranceView *)nobleEntranceView {
|
|
if (!_nobleEntranceView) {
|
|
_nobleEntranceView = [[XPNobleCenterEntranceView alloc] init];
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapNobleCenterRecognizer)];
|
|
[_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;
|
|
}
|
|
|
|
- (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;
|
|
}
|
|
|
|
@end
|