Files
yinmeng-ios/xplan-ios/Main/Mine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m

772 lines
26 KiB
Mathematica
Raw Normal View History

2021-09-23 18:38:33 +08:00
//
// XPMineHeaderView.m
// xplan-ios
//
// Created by on 2021/9/22.
//
#import "XPMineUserInfoHeaderView.h"
///Third
#import <Masonry/Masonry.h>
#import <SDCycleScrollView/SDCycleScrollView.h>
#import "SDPhotoBrowser.h"
#import <ReactiveObjC/ReactiveObjC.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+ImageEffects.h"
2022-04-14 22:02:15 +08:00
#import "UIImage+Utils.h"
#import "NetImageView.h"
#import "NSArray+Safe.h"
2023-03-10 19:25:37 +08:00
#import "XCHUDTool.h"
#import "StatisticsServiceHelper.h"
#import "XPNoteView.h"
2023-03-13 18:02:26 +08:00
#import "XPButton.h"
2021-09-23 18:38:33 +08:00
///Model
#import "UserInfoModel.h"
2023-03-13 18:02:26 +08:00
#import "ClanDetailInfoModel.h"
2021-09-23 18:38:33 +08:00
@interface XPMineUserInfoHeaderView ()<SDCycleScrollViewDelegate, SDPhotoBrowserDelegate>
///
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
2022-04-14 22:02:15 +08:00
///view
@property (nonatomic,strong) UIImageView * coverImageView;
2021-09-23 18:38:33 +08:00
///
2022-04-15 18:11:39 +08:00
@property (nonatomic,strong) UIButton *pageButton;
2021-12-28 02:07:11 +08:00
///
@property (nonatomic,strong) UIImageView *reviewIcon;
2021-09-23 18:38:33 +08:00
///
@property (nonatomic,strong) NSArray *imageUrls;
///
2022-04-15 18:11:39 +08:00
@property (nonatomic,strong) NSMutableArray<UserPhoto *> *userPhtotArray;
2022-04-14 22:02:15 +08:00
///
@property (nonatomic,strong) UIView * userInfoView;
2022-12-19 17:17:04 +08:00
///icon
@property (nonatomic,strong) NetImageView *nobleImageView;
2022-04-14 22:02:15 +08:00
@property (nonatomic,strong) UIStackView *nickStackView;
2023-03-10 19:25:37 +08:00
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UILabel *nameLabel;
///sex
@property (nonatomic,strong) UIImageView *sexImageView;
2022-04-14 22:02:15 +08:00
///
@property (nonatomic,strong) UIView *onlineView;
///
@property (nonatomic,strong) XPNoteView *noteView;
2022-04-14 22:02:15 +08:00
///
@property (nonatomic,strong) UIStackView *idStackView;
///
@property (nonatomic,strong) UIImageView *beautifulImageViw;
///id
@property (nonatomic,strong) UILabel *idLabel;
2023-03-10 19:25:37 +08:00
///id
@property (nonatomic,strong) UIImageView *copysIdImageView;
2022-04-14 22:02:15 +08:00
///
@property (nonatomic,strong) UILabel *fansNumLabel;
///
@property (nonatomic,strong) UIStackView *tagStackView;
///
@property (nonatomic,strong) NetImageView *charmImageView;
///
@property (nonatomic,strong) NetImageView *experImageView;
///
@property (nonatomic,strong) UIView * namePlateView;
///
@property (nonatomic,strong) NetImageView *nameplateImageView;
///
@property (nonatomic,strong) UILabel *nameplateLabel;
///
@property (nonatomic,strong) UIImageView *newUserImageView;
///
@property (nonatomic,strong) UIImageView *officalImageView;
2023-03-13 18:02:26 +08:00
///
@property (nonatomic,strong) XPButton *clanBtn;
2022-04-14 22:02:15 +08:00
///
@property (nonatomic,strong) UIView * signBackView;
///
@property (nonatomic,strong) UILabel *signLabel;
2022-04-14 22:02:15 +08:00
///线
@property (nonatomic,strong) UIView * lineView;
///
@property (nonatomic,strong) UserPhoto *avatarPhoto;
2023-03-13 18:02:26 +08:00
2021-09-23 18:38:33 +08:00
@end
@implementation XPMineUserInfoHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
2021-10-14 21:10:04 +08:00
2021-09-23 18:38:33 +08:00
#pragma mark - Private Method
2022-04-14 22:02:15 +08:00
- (void)initSubViews {
[self addSubview:self.cycleScrollView];
[self addSubview:self.coverImageView];
[self addSubview:self.reviewIcon];
[self addSubview:self.userInfoView];
2023-03-10 19:25:37 +08:00
[self addSubview:self.pageButton];
2023-03-13 18:02:26 +08:00
[self addSubview:self.avatarImageView];
[self addSubview:self.onlineView];
2022-04-14 22:02:15 +08:00
[self.userInfoView addSubview:self.lineView];
2023-03-10 19:25:37 +08:00
[self.userInfoView addSubview:self.fansNumLabel];
2022-04-14 22:02:15 +08:00
[self.userInfoView addSubview:self.signBackView];
2023-03-10 19:25:37 +08:00
[self.userInfoView addSubview:self.nickStackView];
[self.userInfoView addSubview:self.idStackView];
[self.userInfoView addSubview:self.tagStackView];
2023-03-13 18:02:26 +08:00
[self.userInfoView addSubview:self.clanBtn];
[self.onlineView addSubview:self.noteView];
2023-03-10 19:25:37 +08:00
[self.nickStackView addArrangedSubview:self.nobleImageView];
2022-04-14 22:02:15 +08:00
[self.nickStackView addArrangedSubview:self.nameLabel];
[self.nickStackView addArrangedSubview:self.sexImageView];
2023-03-10 19:25:37 +08:00
2022-04-14 22:02:15 +08:00
[self.idStackView addArrangedSubview:self.beautifulImageViw];
[self.idStackView addArrangedSubview:self.idLabel];
2023-03-10 19:25:37 +08:00
[self.idStackView addArrangedSubview:self.copysIdImageView];
2022-04-14 22:02:15 +08:00
///
[self.tagStackView addArrangedSubview:self.newUserImageView];
[self.tagStackView addArrangedSubview:self.officalImageView];
[self.tagStackView addArrangedSubview:self.experImageView];
[self.tagStackView addArrangedSubview:self.charmImageView];
[self.tagStackView addArrangedSubview:self.namePlateView];
///
[self.namePlateView addSubview:self.nameplateImageView];
[self.namePlateView addSubview:self.nameplateLabel];
2023-03-10 19:25:37 +08:00
2022-04-14 22:02:15 +08:00
[self.signBackView addSubview:self.signLabel];
}
2021-09-23 18:38:33 +08:00
- (void)initSubViewConstraints {
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-04-14 22:02:15 +08:00
make.left.right.top.mas_equalTo(self);
2023-03-10 19:25:37 +08:00
make.height.mas_equalTo(237);
2022-04-14 22:02:15 +08:00
}];
[self.coverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.cycleScrollView);
2021-09-23 18:38:33 +08:00
}];
2022-04-14 22:02:15 +08:00
[self.reviewIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.right.mas_equalTo(self);
make.width.mas_equalTo(85);
make.height.mas_equalTo(50);
}];
2022-04-14 22:02:15 +08:00
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self);
make.bottom.mas_equalTo(self);
make.height.mas_equalTo(185);
}];
2023-03-10 19:25:37 +08:00
2022-04-15 18:11:39 +08:00
[self.pageButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
2023-03-10 19:25:37 +08:00
make.width.mas_equalTo(42);
make.height.mas_equalTo(22);
make.bottom.mas_equalTo(self.userInfoView.mas_top).offset(-8);
2022-04-15 18:11:39 +08:00
}];
2022-04-14 22:02:15 +08:00
[self.signBackView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-10 19:25:37 +08:00
make.height.mas_equalTo(54);
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(10);
}];
2022-04-14 22:02:15 +08:00
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.userInfoView).inset(0);
2022-04-14 22:02:15 +08:00
make.bottom.mas_equalTo(self.userInfoView);
make.height.mas_equalTo(20);
2022-04-14 22:02:15 +08:00
}];
2023-03-10 19:25:37 +08:00
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-13 18:02:26 +08:00
make.left.mas_equalTo(self.userInfoView.mas_left).offset(22);
2023-03-10 19:25:37 +08:00
make.centerY.mas_equalTo(self.userInfoView.mas_top);
make.width.height.mas_equalTo(72);
}];
[self.fansNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(12);
make.top.mas_equalTo(10);
}];
2022-04-14 22:02:15 +08:00
2022-12-19 17:17:04 +08:00
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(20);
}];
2022-04-14 22:02:15 +08:00
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-10 19:25:37 +08:00
make.left.mas_equalTo(18);
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(10);
2022-04-14 22:02:15 +08:00
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
}];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
[self.onlineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(20, 20));
make.right.mas_equalTo(self.avatarImageView.mas_right).offset(-2);
make.bottom.mas_equalTo(self.avatarImageView.mas_bottom).offset(-2);
}];
[self.noteView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(0);
make.width.height.mas_equalTo(10);
}];
2022-04-14 22:02:15 +08:00
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-10 19:25:37 +08:00
make.left.mas_equalTo(self.nickStackView);
2022-04-14 22:02:15 +08:00
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(5);
}];
[self.beautifulImageViw mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(15, 15));
}];
2023-03-10 19:25:37 +08:00
[self.copysIdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(10, 10));
}];
2022-04-14 22:02:15 +08:00
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-10 19:25:37 +08:00
make.left.mas_equalTo(self.nickStackView);
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(5);
2022-04-15 18:11:39 +08:00
make.height.mas_equalTo(25);
2022-04-14 22:02:15 +08:00
}];
2023-03-13 18:02:26 +08:00
[self.clanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.tagStackView.mas_right).offset(8);
make.centerY.mas_equalTo(self.tagStackView);
make.height.mas_equalTo(25);
make.right.mas_lessThanOrEqualTo(-8);
}];
2022-04-14 22:02:15 +08:00
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-04-15 18:11:39 +08:00
make.width.height.mas_equalTo(25);
2022-04-14 22:02:15 +08:00
}];
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-04-15 18:11:39 +08:00
make.width.height.mas_equalTo(25);
2022-04-14 22:02:15 +08:00
}];
[self.newUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2022-04-15 18:11:39 +08:00
make.width.height.mas_equalTo(20);
2022-04-14 22:02:15 +08:00
}];
[self.officalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(20);
}];
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(self.nameplateImageView.mas_width);
}];
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(60);
make.left.top.mas_equalTo(self.namePlateView);
}];
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.mas_equalTo(self.nameplateImageView);
make.right.mas_equalTo(self.namePlateView).offset(-2);
}];
[self.signLabel mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-10 19:25:37 +08:00
make.left.mas_equalTo(10);
make.right.mas_equalTo(-10);
make.centerY.mas_equalTo(0);
2022-04-14 22:02:15 +08:00
}];
}
2021-09-23 18:38:33 +08:00
#pragma mark - SDPhotoBrowserDelegate
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
NSString * photoUrl = [self.imageUrls safeObjectAtIndex1:index];
2021-09-23 18:38:33 +08:00
return [NSURL URLWithString:photoUrl];
}
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
return [UIImageConstant defalutBannerPlaceholder];
2021-09-23 18:38:33 +08:00
}
#pragma mark - SDCycleScrollViewDelegate
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
2022-04-15 18:11:39 +08:00
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
UserPhoto * photo = [self.userPhtotArray safeObjectAtIndex1:index];
2022-04-14 22:02:15 +08:00
self.reviewIcon.hidden = !photo.isReview;
2021-09-23 18:38:33 +08:00
}
//
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
NSInteger count = self.imageUrls.count;
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
browser.sourceImagesContainerView = self.cycleScrollView;
browser.delegate = self;
browser.imageCount = count;
browser.currentImageIndex = index;
browser.isMe = NO;
[browser show];
}
#pragma mark - Event Response
2023-03-13 18:02:26 +08:00
- (void)didTapAvatarGuest {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderView:didClickGoToRoom:)]) {
[self.delegate xPMineUserInfoHeaderView:self didClickGoToRoom:self.roomUid];
}
}
2023-03-10 19:25:37 +08:00
- (void)copysIdRecognizer {
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"%ld", self.userInfo.erbanNo];
[XCHUDTool showSuccessWithMessage:@"复制成功"];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventID_mycenter_copyid_click];
}
2023-03-13 18:02:26 +08:00
///
- (void)clanBtnAction {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderViewDidClickClan:)]) {
[self.delegate xPMineUserInfoHeaderViewDidClickClan:self.clanDetailInfo];
}
}
2021-09-23 18:38:33 +08:00
#pragma mark - Getters And Setters
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (_userInfo) {
2023-03-10 19:25:37 +08:00
self.avatarImageView.imageUrl = _userInfo.avatar;
self.nameLabel.text = _userInfo.nick;
2023-01-05 16:33:37 +08:00
self.idLabel.text = [NSString stringWithFormat:@"ID%ld", (long)_userInfo.erbanNo];
2023-03-10 19:25:37 +08:00
self.copysIdImageView.hidden = NO;
self.signLabel.text = _userInfo.userDesc.length > 0 ? _userInfo.userDesc : @"我是个默认签名";
2023-03-10 19:25:37 +08:00
NSString *fansNum = [NSString stringWithFormat:@"%ld",_userInfo.fansNum];
NSString *fansStr = [NSString stringWithFormat:@"粉丝 %@", fansNum];
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:fansStr];
NSRange fansNumRange = NSMakeRange(attrStr.length - fansNum.length, fansNum.length);
[attrStr addAttribute:NSForegroundColorAttributeName value:[ThemeColor mainTextColor] range:fansNumRange];
self.fansNumLabel.attributedText = attrStr;
2022-04-14 22:02:15 +08:00
self.sexImageView.image = userInfo.gender == GenderType_Female ? [UIImage imageNamed:@"common_female"] : [UIImage imageNamed:@"common_male"];
self.officalImageView.hidden = userInfo.defUser != UserLevelType_Offical;
self.beautifulImageViw.hidden = !userInfo.hasPrettyErbanNo;
self.newUserImageView.hidden = !userInfo.newUser;
2023-03-10 19:25:37 +08:00
[self.nobleImageView loadImageWithUrl:userInfo.userVipInfoVO.vipIcon completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
if (image) {
CGFloat scale = image.size.width / image.size.height;
[self.nobleImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(20* scale, 20));
}];
self.nobleImageView.hidden = NO;
}else{
self.nobleImageView.hidden = YES;
}
}];
2022-04-14 22:02:15 +08:00
if (userInfo.userLevelVo.experUrl) {
self.experImageView.imageUrl = userInfo.userLevelVo.experUrl;
}
self.experImageView.hidden = userInfo.userLevelVo.experUrl.length <= 0;
if (userInfo.userLevelVo.charmUrl) {
self.charmImageView.imageUrl = userInfo.userLevelVo.charmUrl;
}
self.charmImageView.hidden = userInfo.userLevelVo.charmUrl.length <= 0;
if (userInfo.nameplateWord.length>0 && userInfo.nameplatePic.length>0) {
self.nameplateImageView.imageUrl = userInfo.nameplatePic;
self.nameplateLabel.text = userInfo.nameplateWord;
self.namePlateView.hidden = NO;
2021-09-23 18:38:33 +08:00
} else {
2022-04-14 22:02:15 +08:00
self.namePlateView.hidden = YES;
}
[self.userPhtotArray removeAllObjects];
//
NSMutableArray * imageUrls = [NSMutableArray array];
2022-04-14 22:02:15 +08:00
if (userInfo.avatar) {
[imageUrls addObject:userInfo.avatar];
if (![self.userPhtotArray containsObject:self.avatarPhoto]) {
[self.userPhtotArray addObject:self.avatarPhoto];
}
self.avatarPhoto.isReview = userInfo.isReview;
self.avatarPhoto.photoUrl = userInfo.avatar;
}
if (self.userInfo.privatePhoto.count > 0) {
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
UserPhoto * photo = [self.userInfo.privatePhoto safeObjectAtIndex1:i];
if (photo.photoUrl.length > 0) {
[self.userPhtotArray addObject:photo];
[imageUrls addObject:photo.photoUrl];
}
}
}
if (imageUrls.count > 0) {
self.imageUrls = imageUrls;
self.cycleScrollView.imageURLStringsGroup = imageUrls;
2022-04-15 18:11:39 +08:00
[self.pageButton setTitle:[NSString stringWithFormat:@"1/%lu",(unsigned long)imageUrls.count] forState:UIControlStateNormal];;
2022-04-14 22:02:15 +08:00
//
2022-04-15 18:11:39 +08:00
self.reviewIcon.hidden = ![self.userPhtotArray objectAtIndex:0].isReview;
2021-09-23 18:38:33 +08:00
}
}
}
- (void)setRoomUid:(NSString *)roomUid {
_roomUid = roomUid;
if (_roomUid.length <= 0) {
self.onlineView.hidden = YES;
self.avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
2023-03-13 18:02:26 +08:00
self.avatarImageView.userInteractionEnabled = NO;
}else{
self.onlineView.hidden = NO;
self.avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor;
2023-03-13 18:02:26 +08:00
self.avatarImageView.userInteractionEnabled = YES;
}
}
2023-03-13 18:02:26 +08:00
- (void)setClanDetailInfo:(ClanDetailInfoModel *)clanDetailInfo {
_clanDetailInfo = clanDetailInfo;
if (_clanDetailInfo.clan.elderUid) {
[self.clanBtn setTitle:[NSString stringWithFormat:@"%@公会成员",_clanDetailInfo.clan.name] forState:UIControlStateNormal];
self.clanBtn.hidden = NO;
self.avatarImageView.userInteractionEnabled = YES;
}else{
self.clanBtn.hidden = YES;
self.avatarImageView.userInteractionEnabled = NO;
}
}
2022-04-14 22:02:15 +08:00
- (UIImageView *)coverImageView {
if (!_coverImageView) {
_coverImageView = [[UIImageView alloc] init];
_coverImageView.userInteractionEnabled = NO;
_coverImageView.image = [UIImage imageNamed:@"mine_userinfo_header_shadow_bg"];
}
return _coverImageView;
}
- (UIView *)userInfoView {
if (!_userInfoView) {
_userInfoView = [[UIView alloc] init];
2023-03-10 19:25:37 +08:00
_userInfoView.backgroundColor = [UIColor whiteColor];
// _userInfoView.layer.masksToBounds = YES;
_userInfoView.layer.cornerRadius = 20;
2022-04-14 22:02:15 +08:00
}
return _userInfoView;
}
2022-12-19 17:17:04 +08:00
- (NetImageView *)nobleImageView {
if (!_nobleImageView) {
2023-03-10 19:25:37 +08:00
_nobleImageView = [[NetImageView alloc] init];
_nobleImageView.hidden = YES;
2022-12-19 17:17:04 +08:00
}
return _nobleImageView;
}
2022-04-14 22:02:15 +08:00
- (UIStackView *)nickStackView {
if (!_nickStackView) {
_nickStackView = [[UIStackView alloc] init];
_nickStackView.axis = UILayoutConstraintAxisHorizontal;
_nickStackView.distribution = UIStackViewDistributionFill;
_nickStackView.alignment = UIStackViewAlignmentCenter;
_nickStackView.spacing = 10;
}
2022-04-14 22:02:15 +08:00
return _nickStackView;
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
2023-03-10 19:25:37 +08:00
_nameLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
_nameLabel.textColor = [ThemeColor mainTextColor];
}
return _nameLabel;
}
- (UIImageView *)sexImageView {
if (!_sexImageView) {
_sexImageView = [[UIImageView alloc] init];
_sexImageView.userInteractionEnabled = YES;
}
return _sexImageView;
}
2022-04-14 22:02:15 +08:00
- (UIStackView *)idStackView {
if (!_idStackView) {
_idStackView = [[UIStackView alloc] init];
_idStackView.axis = UILayoutConstraintAxisHorizontal;
_idStackView.distribution = UIStackViewDistributionFill;
_idStackView.alignment = UIStackViewAlignmentCenter;
_idStackView.spacing = 5;
2023-03-10 19:25:37 +08:00
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copysIdRecognizer)];
[_idStackView addGestureRecognizer:tap];
2022-04-14 22:02:15 +08:00
}
return _idStackView;
}
- (UIImageView *)beautifulImageViw {
if (!_beautifulImageViw) {
_beautifulImageViw = [[UIImageView alloc] init];
_beautifulImageViw.userInteractionEnabled = YES;
2022-04-15 18:11:39 +08:00
_beautifulImageViw.image = [UIImage imageNamed:@"common_icon_beautiful"];
2022-04-14 22:02:15 +08:00
}
return _beautifulImageViw;
}
- (UILabel *)fansNumLabel {
if (!_fansNumLabel) {
_fansNumLabel = [[UILabel alloc] init];
2023-03-10 19:25:37 +08:00
_fansNumLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
_fansNumLabel.textColor = [ThemeColor secondTextColor];
2022-04-14 22:02:15 +08:00
}
return _fansNumLabel;
}
- (UILabel *)idLabel {
if (!_idLabel) {
_idLabel = [[UILabel alloc] init];
2023-03-10 19:25:37 +08:00
_idLabel.font = [UIFont systemFontOfSize:12];
_idLabel.textColor = [ThemeColor textThirdColor];
}
return _idLabel;
}
2021-09-23 18:38:33 +08:00
- (UIView *)onlineView {
if (!_onlineView) {
_onlineView = [[UIView alloc] init];
_onlineView.backgroundColor = [ThemeColor appMainColor];
_onlineView.layer.cornerRadius = 10;
_onlineView.clipsToBounds = YES;
_onlineView.hidden = YES;
}
return _onlineView;
}
- (XPNoteView *)noteView {
if (!_noteView) {
_noteView = [[XPNoteView alloc] init];
_noteView.pillarColor = [UIColor blackColor];
_noteView.pillarWidth = 1.5;
[_noteView startAnimation];
}
return _noteView;
2021-09-23 18:38:33 +08:00
}
- (SDCycleScrollView *)cycleScrollView {
if (!_cycleScrollView) {
2022-04-14 22:02:15 +08:00
_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:[UIImageConstant defalutBannerPlaceholder]];
2021-09-23 18:38:33 +08:00
_cycleScrollView.backgroundColor = [UIColor clearColor];
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
2022-04-14 22:02:15 +08:00
_cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
2021-09-23 18:38:33 +08:00
_cycleScrollView.autoScroll = NO;
}
return _cycleScrollView;
}
2022-04-15 18:11:39 +08:00
- (UIButton *)pageButton {
if (!_pageButton) {
_pageButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_pageButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
2023-03-10 19:25:37 +08:00
_pageButton.titleLabel.font = [UIFont systemFontOfSize:12];
_pageButton.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.2];
_pageButton.layer.cornerRadius = 11;
_pageButton.clipsToBounds = YES;
2021-09-23 18:38:33 +08:00
}
2022-04-15 18:11:39 +08:00
return _pageButton;
2021-09-23 18:38:33 +08:00
}
2022-04-15 18:11:39 +08:00
2021-12-28 02:07:11 +08:00
- (UIImageView *)reviewIcon {
2022-04-14 22:02:15 +08:00
if (!_reviewIcon) {
_reviewIcon = [[UIImageView alloc] init];
_reviewIcon.image = [UIImage imageNamed:@"mine_album_reviewing"];
_reviewIcon.hidden = YES;
}
return _reviewIcon;
2021-12-28 02:07:11 +08:00
}
2022-04-14 22:02:15 +08:00
- (UIStackView *)tagStackView {
if (!_tagStackView) {
_tagStackView = [[UIStackView alloc] init];
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
_tagStackView.distribution = UIStackViewDistributionFill;
_tagStackView.alignment = UIStackViewAlignmentCenter;
_tagStackView.spacing = 2;
}
return _tagStackView;
}
- (NetImageView *)experImageView {
if (!_experImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserCardLevel;
_experImageView = [[NetImageView alloc] initWithConfig:config];
_experImageView.userInteractionEnabled = YES;
_experImageView.hidden = YES;
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _experImageView;
}
- (NetImageView *)charmImageView {
if (!_charmImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserCardLevel;
_charmImageView = [[NetImageView alloc] initWithConfig:config];
_charmImageView.userInteractionEnabled = YES;
_charmImageView.hidden = YES;
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _charmImageView;
}
- (UIView *)namePlateView {
if (!_namePlateView) {
_namePlateView = [[UIView alloc] init];
_namePlateView.backgroundColor = [UIColor clearColor];
_namePlateView.hidden = YES;
}
return _namePlateView;
}
- (NetImageView *)nameplateImageView {
if (!_nameplateImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserCardLevel;
_nameplateImageView = [[NetImageView alloc] initWithConfig:config];
_nameplateImageView.userInteractionEnabled = YES;
_nameplateImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _nameplateImageView;
}
- (UILabel *)nameplateLabel {
if (!_nameplateLabel) {
_nameplateLabel = [[UILabel alloc] init];
_nameplateLabel.font = [UIFont systemFontOfSize:10];
_nameplateLabel.textAlignment = NSTextAlignmentCenter;
_nameplateLabel.textColor = [UIColor whiteColor];
}
return _nameplateLabel;
}
- (UIImageView *)newUserImageView {
if (!_newUserImageView) {
_newUserImageView = [[UIImageView alloc] init];
_newUserImageView.userInteractionEnabled = YES;
_newUserImageView.image = [UIImage imageNamed:@"common_new_user"];
_newUserImageView.hidden = YES;
}
return _newUserImageView;
}
- (UIImageView *)officalImageView {
if (!_officalImageView) {
_officalImageView = [[UIImageView alloc] init];
_officalImageView.userInteractionEnabled = YES;
_officalImageView.image = [UIImage imageNamed:@"common_offical"];
_officalImageView.hidden = YES;
}
return _officalImageView;
}
- (UIView *)signBackView {
if (!_signBackView) {
_signBackView = [[UIView alloc] init];
_signBackView.backgroundColor = [ThemeColor appBackgroundColor];
2023-03-10 19:25:37 +08:00
_signBackView.layer.cornerRadius = 4;
2022-04-14 22:02:15 +08:00
}
return _signBackView;
}
- (UIView *)lineView {
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = UIColor.whiteColor;
2022-04-14 22:02:15 +08:00
}
return _lineView;
}
- (UILabel *)signLabel {
if (!_signLabel) {
_signLabel = [[UILabel alloc] init];
_signLabel.font = [UIFont systemFontOfSize:12];;
_signLabel.textColor = [ThemeColor secondTextColor];
_signLabel.numberOfLines = 2;
}
return _signLabel;
}
- (NSMutableArray *)userPhtotArray {
if (!_userPhtotArray) {
_userPhtotArray = [NSMutableArray array];
}
return _userPhtotArray;
}
2022-04-14 22:02:15 +08:00
- (UserPhoto *)avatarPhoto {
if (!_avatarPhoto) {
_avatarPhoto = [[UserPhoto alloc] init];
}
return _avatarPhoto;
}
2023-03-10 19:25:37 +08:00
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserIcon;
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 36;
_avatarImageView.layer.borderWidth = 1;
_avatarImageView.layer.borderColor = UIColor.whiteColor.CGColor;
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
2023-03-13 18:02:26 +08:00
_avatarImageView.userInteractionEnabled = NO;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapAvatarGuest)];
[_avatarImageView addGestureRecognizer:tap];
2023-03-10 19:25:37 +08:00
}
return _avatarImageView;
}
- (UIImageView *)copysIdImageView {
if (!_copysIdImageView) {
_copysIdImageView = [[UIImageView alloc] init];
_copysIdImageView.userInteractionEnabled = YES;
_copysIdImageView.image = [UIImage imageNamed:@"mine_user_id_copy"];
_copysIdImageView.hidden = YES;
}
return _copysIdImageView;
}
2023-03-13 18:02:26 +08:00
- (XPButton *)clanBtn {
if (!_clanBtn) {
_clanBtn = [XPButton buttonWithType:UIButtonTypeCustom];
[_clanBtn setImage:[UIImage imageNamed:@"mine_user_clan_icon"] forState:UIControlStateNormal];
[_clanBtn setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
_clanBtn.titleLabel.font = [UIFont systemFontOfSize:13];
[_clanBtn addTarget:self action:@selector(clanBtnAction) forControlEvents:UIControlEventTouchUpInside];
_clanBtn.imageTitleSpace = 4;
_clanBtn.hidden = YES;
}
return _clanBtn;
}
2021-09-23 18:38:33 +08:00
@end