Files
peko-ios/YuMi/Modules/YMMine/View/SubViews/MineInfo/XPMineUserInfoHeaderView.m
2024-09-18 10:31:21 +08:00

1233 lines
46 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// 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>
#import <SVGA.h>
#import <YYImage/YYAnimatedImageView.h>
///Tool
#import "UIImage+ImageEffects.h"
#import "UIImage+Utils.h"
#import "NetImageView.h"
#import "XPSkillCardPlayerManager.h"
#import "XPRoomMiniManager.h"
#import "SpriteSheetImageManager.h"
///view
#import "XPMineUserInfoHeaderTagView.h"
#import "XPBeautIDView.h"
///Model
#import "UserInfoModel.h"
#define StackSpring(axis) \
^{\
UIView *view = UIView.new; \
[view mas_makeConstraints:^(MASConstraintMaker *make) {\
if (axis == UILayoutConstraintAxisHorizontal) {\
make.width.mas_equalTo(1000).priorityLow();\
} else {\
make.height.mas_equalTo(1000).priorityLow();\
}\
}];\
return view;\
}()
@interface XPMineUserInfoHeaderView ()<SDCycleScrollViewDelegate, SDPhotoBrowserDelegate,XPMineUserInfoHeaderTagViewDelegate>
///轮播图
@property (nonatomic,strong) SDCycleScrollView *pi_cycleScrollView;
///显示当前的页数
@property (nonatomic,strong) UIButton *pageButton;
///审核中图标
@property (nonatomic,strong) UIImageView *reviewIcon;
///图片数组
@property (nonatomic,strong) NSArray *imageUrls;
///用户的头像和相册
@property (nonatomic,strong) NSMutableArray<UserPhoto *> *userPhotoArray;
///用户信息
@property (nonatomic,strong) UIView * userInfoView;
///头像的
@property (nonatomic,strong) UserPhoto *avatarPhoto;
///头像
@property (nonatomic,strong) NetImageView * avatarView;
@property (nonatomic,strong) NetImageView * avatarView_cp;
///普通的
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
///头饰播放
@property (nonatomic, strong) SpriteSheetImageManager *manager;
@property (nonatomic, strong) SVGAImageView *headWearSvgaImageView;
///用户信息的背景
@property (nonatomic,strong) UIStackView *nickStackView;
///名字
@property (nonatomic,strong) UILabel *nameLabel;
///sex
@property (nonatomic,strong) UIButton *sexImageView;
/////正在直播父图
//@property (nonatomic,strong) UIImageView *onlineView;
///正在直播icon图
@property (nonatomic,strong) SVGAImageView *onlineIconView;
///正在直播中tilte
//@property (nonatomic,strong) UILabel *onlineTitleView;
///正在直播中
@property (nonatomic,strong) UIButton *onlineButton;
///
@property (nonatomic,strong) UIStackView *idStackView;
///id
@property (nonatomic,strong) UILabel *idLabel;
@property (nonatomic, strong) UIImageView *idIconImageView;
@property (nonatomic, strong) UIImageView *copyIdImageView;
@property (nonatomic, strong) XPBeautIDView *beautIDView;
@property (nonatomic, strong) UIButton *copyIdButton;
///魅力等级 等级 铭牌
@property (nonatomic,strong) UIStackView *tagStackView;
///魅力等级
@property (nonatomic,strong) NetImageView *charmImageView;
///等级
@property (nonatomic,strong) NetImageView *experImageView;
///代充
@property (nonatomic,strong) NetImageView *rechargeImageView;
///铭牌的容器
@property (nonatomic,strong) UIView * namePlateView;
///铭牌图片
@property (nonatomic,strong) NetImageView *nameplateImageView;
///铭牌文字
@property (nonatomic,strong) UILabel *nameplateLabel;
///新用户
@property (nonatomic,strong) UIImageView *newUserImageView;
///官方的
@property (nonatomic,strong) UIImageView *officialImageView;
///标签跟签名容器
@property (nonatomic,strong) UIStackView *singStackView;
///标签
@property (nonatomic,strong) XPMineUserInfoHeaderTagView *tagView;
///签名的背景
@property (nonatomic,strong) UIView * signBackView;
///签名
@property (nonatomic,strong) UILabel *signatureLabel;
///分割线
//@property (nonatomic,strong) UIView * lineView;
///VIP等级icon
@property (nonatomic,strong) NetImageView *nobleImageView;
@property (nonatomic, strong) UIStackView *locateDateStackView;
@property (nonatomic, strong) UILabel *locateLabel;
@property (nonatomic, strong) UIImageView *relationshipView;
@property (nonatomic, strong) UILabel *fansNum;
@property (nonatomic, strong) UILabel *followersNum;
@end
@implementation XPMineUserInfoHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setupUI];
}
return self;
}
+ (CGFloat)headerHeight:(UserInfoModel *)model {
CGFloat height = 0;
NSInteger numberOfLines = 1;
if (model.userDesc.length > 0) {
// 限定宽度
CGFloat maxWidth = KScreenWidth - 70;
UIFont *font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
// 设置计算属性
NSDictionary *attributes = @{NSFontAttributeName:font};
// 计算文本的矩形区域
CGRect textRect = [model.userDesc boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:attributes
context:nil];
// 计算每行的高度
CGFloat lineHeight = font.lineHeight;
// 计算行数
numberOfLines = ceil(textRect.size.height / lineHeight);
}
height = 470 + 14 * numberOfLines;
return height;
}
#pragma mark - Private Method
- (void)setupUI {
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.pi_cycleScrollView];
[self.pi_cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.top.mas_equalTo(self);
make.height.mas_equalTo(kGetScaleWidth(195));
}];
// 创建一个新的视图作为蒙层
UIView *overlay = [[UIView alloc] initWithFrame:self.pi_cycleScrollView.bounds];
// 设置蒙层背景色为黑色,透明度为 0.5
overlay.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
// 将蒙层添加到目标视图
[self.pi_cycleScrollView addSubview:overlay];
// 确保蒙层大小适应目标视图的变化
overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[overlay mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.pi_cycleScrollView);
}];
[self addSubview:self.onlineButton];
[self.onlineButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self).offset(10);
make.top.mas_equalTo(self).offset(104);
make.height.mas_equalTo(24);
}];
[self.onlineButton addSubview:self.onlineIconView];
[self.onlineIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(8);
make.centerY.mas_equalTo(0);
make.width.mas_equalTo(12);
make.height.mas_equalTo(12);
}];
@kWeakify(self);
SVGAParser * parser = [[SVGAParser alloc]init];
[parser parseWithNamed:@"pi_new_mine_info_online" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.onlineIconView.loops = 0;
self.onlineIconView.clearsAfterStop = NO;
self.onlineIconView.videoItem = videoItem;
[self.onlineIconView startAnimation];
} failureBlock:^(NSError * _Nonnull error) { }];
[self addSubview:self.pageButton];
[self.pageButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self);
make.top.mas_equalTo(self.onlineButton.mas_bottom).offset(76);
make.size.mas_equalTo(CGSizeMake(63, 23));
}];
[self addSubview:self.userInfoView];
[self.userInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self);
make.top.mas_equalTo(self.pi_cycleScrollView.mas_bottom);
make.bottom.mas_equalTo(self);
}];
[self addSubview:self.avatarView];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(72));
make.centerX.mas_equalTo(0);
make.centerY.equalTo(self.userInfoView.mas_top);
}];
[self addSubview:self.headWearImageView];
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.avatarView);
make.width.height.mas_equalTo(kGetScaleWidth(92));
}];
[self addSubview:self.headWearSvgaImageView];
[self.headWearSvgaImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.avatarView);
make.width.height.mas_equalTo(kGetScaleWidth(96));
}];
[self addSubview:self.reviewIcon];
[self setupNameArea];
[self setupIDArea];
[self setupLocateArea];
[self setupTagsArea];
[self setupCustomDesc];
[self setupRelationshipArea];
}
- (void)setupNameArea {
[self.userInfoView addSubview:self.nickStackView];
[self.nickStackView addArrangedSubview:self.nobleImageView];
[self.nickStackView addArrangedSubview:self.nameLabel];
[self.nickStackView addArrangedSubview:self.sexImageView];
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.userInfoView);
make.top.mas_equalTo(self.avatarView.mas_bottom).offset(10);
make.height.mas_equalTo(20);
}];
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(CGSizeMake(35, 25));
}];
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(14);
}];
}
- (void)setupIDArea {
[self.userInfoView addSubview:self.idStackView];
[self.userInfoView addSubview:self.beautIDView];
if (isMSRTL()) {
[self.idStackView addArrangedSubview:self.copyIdImageView];
[self.idStackView addArrangedSubview:self.idLabel];
[self.idStackView addArrangedSubview:self.idIconImageView];
} else {
[self.idStackView addArrangedSubview:self.idIconImageView];
[self.idStackView addArrangedSubview:self.idLabel];
[self.idStackView addArrangedSubview:self.copyIdImageView];
}
[self.idStackView addSubview:self.copyIdButton];
[self.beautIDView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(6);
make.height.mas_equalTo(24);
make.centerX.mas_equalTo(self.userInfoView);
}];
[self.idStackView mas_makeConstraints:^(MASConstraintMaker *make) {
if (isMSRTL()) {
make.centerX.mas_equalTo(self.userInfoView).offset(8);
} else {
make.centerX.mas_equalTo(self.userInfoView);
}
make.top.mas_equalTo(self.nickStackView.mas_bottom).offset(6);
make.height.mas_equalTo(24);
}];
[self.idIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(14);
}];
[self.copyIdButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.idStackView);
}];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(14);
}];
[self.copyIdImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(14, 14));
}];
}
- (void)setupLocateArea {
[self.userInfoView addSubview:self.locateDateStackView];
[self.locateDateStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self.userInfoView);
make.top.mas_equalTo(self.idStackView.mas_bottom).offset(4);
}];
[self.locateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(14);
}];
[self.locateDateStackView addArrangedSubview:[self stackSpaceView]];
[self.locateDateStackView addArrangedSubview:self.locateLabel];
[self.locateDateStackView addArrangedSubview:[self stackSpaceView]];
}
- (void)setupTagsArea {
[self.userInfoView addSubview:self.tagStackView];
///用户信息中的标签
// [self.tagStackView addArrangedSubview:[self stackSpaceView]];
[self.tagStackView addArrangedSubview:self.newUserImageView];
[self.tagStackView addArrangedSubview:self.officialImageView];
[self.tagStackView addArrangedSubview:self.experImageView];
[self.tagStackView addArrangedSubview:self.charmImageView];
[self.tagStackView addArrangedSubview:self.namePlateView];
[self.tagStackView addArrangedSubview:self.rechargeImageView];
// [self.tagStackView addArrangedSubview:[self stackSpaceView]];
///铭牌
[self.namePlateView addSubview:self.nameplateImageView];
[self.namePlateView addSubview:self.nameplateLabel];
[self.nameplateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.top.mas_equalTo(0);
make.width.mas_equalTo(80);
}];
[self.nameplateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.mas_equalTo(self.nameplateImageView);
make.trailing.mas_equalTo(self.namePlateView).offset(-2);
}];
[self.tagStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.locateDateStackView.mas_bottom).offset(4);
make.centerX.mas_equalTo(self.userInfoView);
make.leading.mas_equalTo(self.newUserImageView);
make.trailing.mas_equalTo(self.rechargeImageView);
}];
[self.newUserImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(20);
}];
[self.officialImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(20);
}];
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(34);
}];
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(34);
}];
[self.rechargeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(18);
make.width.mas_equalTo(54);
}];
[self.namePlateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(80);
}];
}
- (void)setupCustomDesc {
[self.userInfoView addSubview:self.signatureLabel];
[self.signatureLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.userInfoView);
make.top.mas_equalTo(self.tagStackView.mas_bottom).offset(4);
make.width.mas_equalTo(KScreenWidth - 70);
}];
}
- (void)setupRelationshipArea {
[self.userInfoView addSubview:self.relationshipView];
[self.relationshipView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.signatureLabel.mas_bottom).offset(10);
make.leading.mas_equalTo(self.userInfoView).offset(14);
make.trailing.mas_equalTo(self.userInfoView).offset(-14);
make.height.mas_equalTo(55);
}];
UIView *line = [[UIView alloc] init];
line.backgroundColor = [UIColor colorWithWhite:1 alpha:0.6];
[self.relationshipView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.relationshipView);
make.size.mas_equalTo(CGSizeMake(1.5, 20));
}];
UILabel *followerTitle = [UILabel labelInitWithText:YMLocalizedString(@"XPMineHeadView4")
font:[UIFont systemFontOfSize:13 weight:UIFontWeightBold]
textColor:[UIColor colorWithWhite:1 alpha:0.8]];
UILabel *fansTitle = [UILabel labelInitWithText:YMLocalizedString(@"XPMineHeadView5")
font:[UIFont systemFontOfSize:13 weight:UIFontWeightBold]
textColor:[UIColor colorWithWhite:1 alpha:0.8]];
[self.relationshipView addSubview:followerTitle];
[followerTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.relationshipView).offset(10);
make.trailing.mas_equalTo(line.mas_leading).offset(-60);
}];
[self.relationshipView addSubview:fansTitle];
[fansTitle mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.relationshipView).offset(10);
make.leading.mas_equalTo(line.mas_trailing).offset(60);
}];
[self.relationshipView addSubview:self.followersNum];
[self.followersNum mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(followerTitle);
make.top.mas_equalTo(followerTitle.mas_bottom).offset(4);
}];
[self.relationshipView addSubview:self.fansNum];
[self.fansNum mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(fansTitle);
make.top.mas_equalTo(fansTitle.mas_bottom).offset(4);
}];
}
- (void)initSubViews {
[self.singStackView addArrangedSubview:self.tagView];
[self.singStackView addArrangedSubview:self.signBackView];
[self.signBackView addSubview:self.signatureLabel];
}
#pragma mark - SDPhotoBrowserDelegate
- (NSURL *)photoBrowser:(SDPhotoBrowser *)browser highQualityImageURLForIndex:(NSInteger)index {
if(browser.isAvatar == YES){
return [NSURL URLWithString:self.avatarView.imageUrl];
}
NSString * photoUrl = [self.imageUrls objectAtIndex:index];
return [NSURL URLWithString:photoUrl];
}
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
return [UIImageConstant defaultBannerPlaceholder];
}
#pragma mark - SDCycleScrollViewDelegate
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
UserPhoto * photo = [self.userPhotoArray objectAtIndex:index];
self.reviewIcon.hidden = !photo.isReview;
}
// 轮播图点击
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
NSInteger count = self.imageUrls.count;
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
browser.sourceImagesContainerView = self.pi_cycleScrollView;
browser.delegate = self;
browser.imageCount = count;
browser.currentImageIndex = index;
browser.isMe = NO;
[browser show];
}
///复制id
-(void)copyNameAction{
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"XPMineUserInfoHeaderView0")];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard. string = [NSString stringWithFormat:@"%ld", (long)_userInfo.erbanNo];
}
#pragma mark - XPMineUserInfoHeaderTagView
- (void)didClickGotoIvidualView{
if(self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderView:didClickGotoEditView:)]){
[self.delegate xPMineUserInfoHeaderView:self didClickGotoEditView:self.tagView.itemList];
}
}
- (void)didClickGotoEditVC{
if(self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderView:didClickGotoEditVC:)]){
[self.delegate xPMineUserInfoHeaderView:self didClickGotoEditVC:self.tagView.itemList];
}
}
#pragma mark - Event Response
-(void)clickAvatarAction{
SDPhotoBrowser *browser = [[SDPhotoBrowser alloc]init];
browser.sourceImagesContainerView = self.avatarView;
browser.delegate = self;
browser.imageCount = 1;
browser.currentImageIndex = 0;
browser.isMe = NO;
browser.isAvatar = YES;
[browser show];
}
- (void)onlineButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineUserInfoHeaderView:didClickGoToRoom:)]) {
[self.delegate xPMineUserInfoHeaderView:self didClickGoToRoom:self.roomUid];
}
}
#pragma mark - Getters And Setters
- (CGFloat)widthOfText:(NSString *)text withFont:(UIFont *)font {
NSDictionary *attributes = @{NSFontAttributeName: font};
CGSize textSize = [text sizeWithAttributes:attributes];
return textSize.width;
}
- (void)setUserInfo:(UserInfoModel *)userInfo {
_userInfo = userInfo;
if (!_userInfo) {
return;
}
[self updateNameAndGenderInfo];
[self updateIDInfo];
[self updateLocateAndRegionInfo];
[self updateSignatureInfo];
[self updateRelationShipInfo];
[self updateHeadwearInfo];
self.officialImageView.hidden = userInfo.defUser != UserLevelType_Offical;
self.newUserImageView.hidden = !userInfo.newUser;
if (userInfo.userLevelVo.experUrl) {
[self.experImageView loadImageWithUrl:userInfo.userLevelVo.experUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
self.experImageView.image = image;
CGFloat width = image.size.width*20/ (image.size.height > 0 ? image.size.height : 1);
[self.experImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(width);
}];
}];
}
self.experImageView.hidden = userInfo.userLevelVo.experUrl.length <= 0;
if (userInfo.userLevelVo.charmUrl) {
[self.charmImageView loadImageWithUrl:userInfo.userLevelVo.charmUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
self.charmImageView.image = image;
CGFloat width = image.size.width*20/ (image.size.height > 0 ? image.size.height : 1);
[self.charmImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(width);
}];
}] ;
}
self.charmImageView.hidden = userInfo.userLevelVo.charmUrl.length <= 0;
if(userInfo.isCustomWord == YES){
if (userInfo.nameplatePic.length > 0) {
self.nameplateImageView.imageUrl = userInfo.nameplatePic;
self.namePlateView.hidden = NO;
} else {
self.namePlateView.hidden = YES;
}
}else{
if (userInfo.nameplateWord.length > 0 && userInfo.nameplatePic.length > 0) {
self.nameplateImageView.imageUrl = userInfo.nameplatePic;
self.nameplateLabel.text = userInfo.nameplateWord;
self.namePlateView.hidden = NO;
} else {
self.namePlateView.hidden = YES;
}
}
self.rechargeImageView.hidden = !_userInfo.isRechargeUser;
[self.userPhotoArray removeAllObjects];
// 轮播图
NSMutableArray * imageUrls = [NSMutableArray array];
if (userInfo.avatar) {
[imageUrls addObject:userInfo.avatar];
if (![self.userPhotoArray containsObject:self.avatarPhoto]) {
[self.userPhotoArray addObject:self.avatarPhoto];
}
self.avatarPhoto.isReview = userInfo.isReview;
self.avatarPhoto.photoUrl = userInfo.avatar;
self.avatarView.imageUrl = userInfo.avatar;
}
if (self.userInfo.privatePhoto.count > 0) {
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
UserPhoto * photo = [self.userInfo.privatePhoto objectAtIndex:i];
if (photo.photoUrl.length > 0) {
[self.userPhotoArray addObject:photo];
[imageUrls addObject:photo.photoUrl];
}
}
}
if (imageUrls.count > 0) {
self.imageUrls = imageUrls;
self.pi_cycleScrollView.imageURLStringsGroup = imageUrls;
[self.pageButton setTitle:[NSString stringWithFormat:@"1/%lu",(unsigned long)imageUrls.count] forState:UIControlStateNormal];;
// 要初始化一下当前的审核状态
if(self.userPhotoArray.count > 0){
self.reviewIcon.hidden = ![self.userPhotoArray objectAtIndex:0].isReview;
}
}
if (userInfo.userVipInfoVO.vipIcon.length > 0) {
self.nobleImageView.hidden = NO;
self.nobleImageView.imageUrl = userInfo.userVipInfoVO.vipIcon;
} else {
self.nobleImageView.hidden = YES;
}
}
- (void)setRoomUid:(NSString *)roomUid {
_roomUid = roomUid;
if([XPSkillCardPlayerManager shareInstance].isInRoom == YES || [[XPRoomMiniManager shareManager] getRoomInfo] != nil){
self.onlineButton.hidden = _roomUid.length <= 0;
}else{
self.onlineButton.hidden = YES;
}
}
-(void)setTagModel:(XPMineUserInfoTagModel *)tagModel{
_tagModel = tagModel;
NSMutableArray *itemList = [NSMutableArray array];
for (NSString *text in _tagModel.meLabels) {
if(text.length > 0){
XPMineUserInfoTagItemModel *model = [XPMineUserInfoTagItemModel new];
model.label = text;
CGRect stringRect = [text boundingRectWithSize:CGSizeMake(MAXFLOAT, 18)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10 weight:UIFontWeightRegular]}
context:nil];
model.width = stringRect.size.width + 14;
[itemList addObject:model];
}
}
NSString *uid = [[AccountInfoStorage instance]getUid];
BOOL isMe = self.userInfo.uid == uid.integerValue;
if(isMe == YES){
_tagView.hidden = YES;
}else{
// _tagView.hidden = !(itemList.count > 0);
_tagView.hidden = YES;
}
_tagView.uid = @(self.userInfo.uid).stringValue;
_tagView.itemList = itemList;
}
- (void)updateNameAndGenderInfo {
self.nameLabel.text = self.userInfo.nick;
UIImage *sexBackgroundImage = nil;
if (self.userInfo.gender == GenderType_Male) {
sexBackgroundImage = [UIImage gradientColorImageFromColors:@[UIColorRGBAlpha(0x6BB3FF, 0.5),UIColorFromRGB(0x6BB3FF)]
gradientType:GradientTypeTopToBottom
imgSize:CGSizeMake(35, 16)];
} else {
sexBackgroundImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF2A0C3),UIColorFromRGB(0xEB74A6)]
gradientType:GradientTypeTopToBottom
imgSize:CGSizeMake(35, 16)];
}
[self.sexImageView setTitle:[NSString getAgeWithBirth:self.userInfo.birth] forState:UIControlStateNormal];
[self.sexImageView setBackgroundImage:sexBackgroundImage forState:UIControlStateNormal];
}
- (void)updateIDInfo {
NSString *text = @"";
BOOL hasBeautifulID = self.userInfo.hasPrettyErbanNo;
if (hasBeautifulID) {
text = [NSString stringWithFormat:@"%ld", (long)self.userInfo.erbanNo];
} else {
text = [NSString stringWithFormat:@" %ld", (long)self.userInfo.erbanNo];
}
self.idIconImageView.hidden = hasBeautifulID;
if (hasBeautifulID) {
self.beautIDView.num = text;
self.idStackView.hidden = YES;
} else {
self.beautIDView.hidden = YES;
self.idLabel.text = text;
self.idLabel.alpha = 0.8;
}
}
- (void)updateLocateAndRegionInfo {
NSString *locateString = @"";
if (self.userInfo.region.length > 0) {
locateString = [NSString stringWithFormat:@"%@ | ", self.userInfo.region];
}
NSDate *date = [NSDate dateWithTimeIntervalSince1970:self.userInfo.birth/1000];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [dateFormatter stringFromDate:date];
self.locateLabel.text = [NSString stringWithFormat:@"%@%@", locateString, dateString];
}
- (void)updateSignatureInfo {
self.signatureLabel.text = _userInfo.userDesc.length > 0 ? self.userInfo.userDesc : YMLocalizedString(@"XPMineUserInfoHeaderView6");
[self.signatureLabel setTextColor:self.userInfo.userDesc.length > 0 ? UIColorFromRGB(0x1a1a1a) : UIColorRGBAlpha(0x1a1a1a, 0.6)];
[self.signatureLabel setFont:self.userInfo.userDesc.length > 0 ? [UIFont systemFontOfSize:12 weight:UIFontWeightMedium] : [UIFont systemFontOfSize:12 weight:UIFontWeightRegular]];
}
- (void)updateRelationShipInfo {
self.fansNum.text = [@(self.userInfo.fansNum) stringValue];
self.followersNum.text = [@(self.userInfo.followNum) stringValue];
}
- (void)updateHeadwearInfo {
NSString *headerUrl = self.userInfo.headwearEffect.length > 0 ? self.userInfo.headwearEffect : self.userInfo.headwearPic;
if (headerUrl.length == 0) {
self.headWearImageView.hidden = YES;
self.headWearSvgaImageView.hidden = YES;
} else {
if ([self.userInfo isHeadWearSVGA]) {
[self playSVGA:headerUrl];
} else {
[self playAnimate:headerUrl];
}
}
}
- (void)playSVGA:(NSString *)svgaUrlString {
[self.headWearSvgaImageView setImageName:svgaUrlString];
return;
@kWeakify(self);
SVGAParser * parser = [[SVGAParser alloc]init];
NSURL *url = [NSURL URLWithString:svgaUrlString];
[parser parseWithURL:url
completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
self.headWearSvgaImageView.hidden = NO;
self.headWearSvgaImageView.loops = 0;
self.headWearSvgaImageView.clearsAfterStop = NO;
self.headWearSvgaImageView.videoItem = videoItem;
[self.headWearSvgaImageView startAnimation];
}
failureBlock:^(NSError * _Nullable error) {}];
}
- (void)playAnimate:(NSString *)headwearUrlString {
self.headWearImageView.hidden = NO;
NSURL *url = [NSURL URLWithString:headwearUrlString];
@kWeakify(self);
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self);
self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) {}];
}
#pragma mark - Getters
- (UIView *)userInfoView {
if (!_userInfoView) {
_userInfoView = [[UIView alloc] init];
_userInfoView.backgroundColor = [UIColor whiteColor];
_userInfoView.layer.masksToBounds = YES;
_userInfoView.layer.cornerRadius = 16;
_userInfoView.clipsToBounds = YES;
}
return _userInfoView;
}
- (UIStackView *)nickStackView {
if (!_nickStackView) {
_nickStackView = [[UIStackView alloc] init];
_nickStackView.backgroundColor = [UIColor clearColor];
_nickStackView.axis = UILayoutConstraintAxisHorizontal;
_nickStackView.distribution = UIStackViewDistributionFill;
_nickStackView.alignment = UIStackViewAlignmentCenter;
_nickStackView.spacing = 4;
if (isMSRTL()) {
_nickStackView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
}
}
return _nickStackView;
}
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
_nameLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
_nameLabel.textColor = UIColorFromRGB(0x1A1A1A);
_nameLabel.numberOfLines = 1;
[_nameLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[_nameLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _nameLabel;
}
- (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, 2, 0, 0);
_sexImageView.layer.cornerRadius = 14/2;
_sexImageView.layer.masksToBounds = YES;
}
return _sexImageView;
}
- (UIStackView *)idStackView {
if (!_idStackView) {
_idStackView = [[UIStackView alloc] init];
_idStackView.backgroundColor = [UIColor clearColor];
_idStackView.distribution = UIStackViewDistributionFill;
_idStackView.alignment = UIStackViewAlignmentCenter;
_idStackView.userInteractionEnabled = YES;
_idStackView.spacing = 2;
_idStackView.clipsToBounds = NO;
}
return _idStackView;
}
- (UILabel *)idLabel {
if (!_idLabel) {
_idLabel = [[UILabel alloc] init];
_idLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium];
_idLabel.textColor = UIColorFromRGB(0x191919);
_idLabel.textAlignment = NSTextAlignmentCenter;
_idLabel.userInteractionEnabled = YES;
_idLabel.clipsToBounds = NO;
}
return _idLabel;
}
- (UIImageView *)idIconImageView {
if (!_idIconImageView) {
_idIconImageView = [[UIImageView alloc] init];
_idIconImageView.userInteractionEnabled = YES;
_idIconImageView.image = [UIImage getLanguageImage:@"user_info_id_mark"];
}
return _idIconImageView;
}
- (UIImageView *)copyIdImageView {
if (!_copyIdImageView) {
_copyIdImageView = [[UIImageView alloc] init];
_copyIdImageView.userInteractionEnabled = YES;
_copyIdImageView.contentMode = UIViewContentModeScaleAspectFit;
_copyIdImageView.image = [UIImage getLanguageImage:@"user_card_copy_id1"];
}
return _copyIdImageView;
}
- (UIButton *)copyIdButton {
if (!_copyIdButton) {
_copyIdButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_copyIdButton addTarget:self action:@selector(copyNameAction) forControlEvents:UIControlEventTouchUpInside];
}
return _copyIdButton;
}
- (XPBeautIDView *)beautIDView {
if (!_beautIDView) {
_beautIDView = [[XPBeautIDView alloc] init];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copyNameAction)];
[_beautIDView addGestureRecognizer:tap];
}
return _beautIDView;
}
- (SVGAImageView *)onlineIconView {
if (_onlineIconView == nil) {
_onlineIconView = [[SVGAImageView alloc]init];
_onlineIconView.contentMode = UIViewContentModeScaleToFill;
_onlineIconView.userInteractionEnabled = NO;
_onlineIconView.backgroundColor = [UIColor clearColor];
}
return _onlineIconView;
}
- (UIButton *)onlineButton {
if (!_onlineButton) {
_onlineButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_onlineButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xf2a20f), UIColorFromRGB(0xffd936)]
gradientType:GradientTypeLeftToRight
imgSize:CGSizeMake(64, 24)]
forState:UIControlStateNormal];
[_onlineButton addTarget:self
action:@selector(onlineButtonAction:)
forControlEvents:UIControlEventTouchUpInside];
[_onlineButton setTitle:[NSString stringWithFormat:@"%@ ", YMLocalizedString(@"XPMineSimpleUserInfoHeaderView2")]
forState:UIControlStateNormal];
[_onlineButton.titleLabel setFont:[UIFont systemFontOfSize:12 weight:UIFontWeightMedium]];
[_onlineButton setTitleColor:UIColorFromRGB(0xf7f7f7) forState:UIControlStateNormal];
// [_onlineButton setImage:[UIImage imageNamed:@"mine_online_mark"] forState:UIControlStateNormal];
[_onlineButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
_onlineButton.layer.cornerRadius = 12;
_onlineButton.layer.masksToBounds = YES;
_onlineButton.hidden = YES;
// CGFloat spacing = 4.0; // 图片和标题之间的间距
_onlineButton.imageEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0);
_onlineButton.titleEdgeInsets = UIEdgeInsetsMake(0, 24, 0, 0);
}
return _onlineButton;
}
- (SDCycleScrollView *)pi_cycleScrollView {
if (!_pi_cycleScrollView) {
_pi_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero
delegate:self
placeholderImage:[UIImageConstant defaultBannerPlaceholder]];
_pi_cycleScrollView.backgroundColor = [UIColor clearColor];
_pi_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
_pi_cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;//SDCycleScrollViewPageContolStyleNone;
_pi_cycleScrollView.autoScroll = NO;
// SDCycleScrollView没有适配阿语在RTL下会乱滚都用LTR算了
_pi_cycleScrollView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
for (UIView *subView in _pi_cycleScrollView.subviews) {
subView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight;
}
}
return _pi_cycleScrollView;
}
- (UIButton *)pageButton {
if (!_pageButton) {
_pageButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_pageButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_pageButton.titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular];
_pageButton.backgroundColor = UIColorRGBAlpha(0x000000, 0.4);
_pageButton.layer.cornerRadius = 11;
_pageButton.layer.masksToBounds = YES;
}
return _pageButton;
}
- (UIImageView *)reviewIcon {
if (!_reviewIcon) {
_reviewIcon = [[UIImageView alloc] init];
_reviewIcon.image = [UIImage getLanguageImage:@"mine_album_reviewing"];
_reviewIcon.hidden = YES;
}
return _reviewIcon;
}
- (UIStackView *)tagStackView {
if (!_tagStackView) {
_tagStackView = [[UIStackView alloc] init];
_tagStackView.axis = UILayoutConstraintAxisHorizontal;
_tagStackView.distribution = UIStackViewDistributionFill;
_tagStackView.alignment = UIStackViewAlignmentCenter;
_tagStackView.spacing = 6;
}
return _tagStackView;
}
- (NetImageView *)experImageView {
if (!_experImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserCardLevel;
_experImageView = [[NetImageView alloc] initWithConfig:config];
_experImageView.userInteractionEnabled = YES;
_experImageView.hidden = YES;
_experImageView.contentMode = UIViewContentModeScaleToFill;
}
return _experImageView;
}
- (NetImageView *)charmImageView {
if (!_charmImageView) {
NetImageConfig * config = [[NetImageConfig alloc] init];
config.imageType = ImageTypeUserCardLevel;
_charmImageView = [[NetImageView alloc] initWithConfig:config];
_charmImageView.userInteractionEnabled = YES;
_charmImageView.hidden = YES;
_charmImageView.contentMode = UIViewContentModeScaleToFill;
}
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 getLanguageImage:@"common_new_user"];
_newUserImageView.hidden = YES;
}
return _newUserImageView;
}
- (UIImageView *)officialImageView {
if (!_officialImageView) {
_officialImageView = [[UIImageView alloc] init];
_officialImageView.userInteractionEnabled = YES;
_officialImageView.image = [UIImage imageNamed:@"common_offical"];
_officialImageView.hidden = YES;
}
return _officialImageView;
}
- (UIView *)signBackView {
if (!_signBackView) {
_signBackView = [[UIView alloc] init];
_signBackView.backgroundColor = [UIColor whiteColor];
}
return _signBackView;
}
- (UILabel *)signatureLabel {
if (!_signatureLabel) {
_signatureLabel = [[UILabel alloc] init];
_signatureLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_signatureLabel.textColor = UIColorFromRGB(0x1a1a1a);
_signatureLabel.numberOfLines = 0;
_signatureLabel.textAlignment = NSTextAlignmentCenter;
}
return _signatureLabel;
}
- (NSMutableArray *)userPhotoArray {
if (!_userPhotoArray) {
_userPhotoArray = [NSMutableArray array];
}
return _userPhotoArray;
}
- (UserPhoto *)avatarPhoto {
if (!_avatarPhoto) {
_avatarPhoto = [[UserPhoto alloc] init];
}
return _avatarPhoto;
}
-(NetImageView *)avatarView{
if (!_avatarView){
NetImageConfig * config = [[NetImageConfig alloc] init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
config.imageType = ImageTypeUserIcon;
_avatarView = [[NetImageView alloc]initWithConfig:config];
_avatarView.layer.cornerRadius = kGetScaleWidth(36);
_avatarView.layer.masksToBounds = YES;
_avatarView.layer.borderWidth = 1;
_avatarView.userInteractionEnabled = YES;
_avatarView.layer.borderColor = [UIColor whiteColor].CGColor;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAvatarAction)];
[_avatarView addGestureRecognizer:tap];
}
return _avatarView;
}
- (YYAnimatedImageView *)headWearImageView {
if (!_headWearImageView) {
_headWearImageView = [[YYAnimatedImageView alloc] init];
_headWearImageView.backgroundColor = [UIColor clearColor];
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
_headWearImageView.layer.masksToBounds = YES;
_headWearImageView.layer.cornerRadius = 10;
}
return _headWearImageView;
}
- (SpriteSheetImageManager *)manager {
if (!_manager) {
_manager = [[SpriteSheetImageManager alloc] init];
}
return _manager;
}
-(XPMineUserInfoHeaderTagView *)tagView{
if (!_tagView){
_tagView = [[XPMineUserInfoHeaderTagView alloc]initWithFrame:CGRectZero];
_tagView.delegate = self;
}
return _tagView;
}
- (UIStackView *)singStackView {
if (!_singStackView) {
_singStackView = [[UIStackView alloc] init];
_singStackView.backgroundColor = [UIColor clearColor];
_singStackView.axis = UILayoutConstraintAxisVertical;
_singStackView.distribution = UIStackViewDistributionFill;
_singStackView.alignment = UIStackViewAlignmentCenter;
_singStackView.spacing = 11;
}
return _singStackView;
}
- (NetImageView *)rechargeImageView{
if(!_rechargeImageView){
_rechargeImageView = [NetImageView new];
_rechargeImageView.image = [UIImage getLanguageImage:@"mine_info_recharge"];
_rechargeImageView.hidden = YES;
}
return _rechargeImageView;
}
- (NetImageView *)nobleImageView {
if (!_nobleImageView) {
_nobleImageView = [[NetImageView alloc] init];
_nobleImageView.contentMode = UIViewContentModeScaleAspectFit;
_nobleImageView.hidden = YES;
}
return _nobleImageView;
}
- (UIStackView *)locateDateStackView {
if (!_locateDateStackView) {
_locateDateStackView = [[UIStackView alloc] init];
_locateDateStackView.backgroundColor = [UIColor clearColor];
_locateDateStackView.axis = UILayoutConstraintAxisHorizontal;
_locateDateStackView.distribution = UIStackViewDistributionEqualCentering;
_locateDateStackView.alignment = UIStackViewAlignmentCenter;
_locateDateStackView.spacing = 6;
}
return _locateDateStackView;
}
- (UILabel *)locateLabel {
if (!_locateLabel) {
_locateLabel = [[UILabel alloc] init];
_locateLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_locateLabel.textColor = UIColorFromRGB(0x1a1a1a);
}
return _locateLabel;
}
- (UIImageView *)relationshipView {
if (!_relationshipView) {
_relationshipView = [[UIImageView alloc] init];
_relationshipView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x41EABA), UIColorFromRGB(0x26cc9c)]
gradientType:GradientTypeTopToBottom
imgSize:CGSizeMake(360, 55)];
_relationshipView.layer.cornerRadius = 14.5;
_relationshipView.layer.masksToBounds = YES;
_relationshipView.userInteractionEnabled = YES;
}
return _relationshipView;
}
- (UIView *)stackSpaceView {
return [UIView new];
}
- (UILabel *)fansNum {
if (!_fansNum) {
_fansNum = [[UILabel alloc] init];
_fansNum.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
_fansNum.textColor = [UIColor whiteColor];
}
return _fansNum;
}
- (UILabel *)followersNum {
if (!_followersNum) {
_followersNum = [[UILabel alloc] init];
_followersNum.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold];
_followersNum.textColor = [UIColor whiteColor];
}
return _followersNum;
}
- (SVGAImageView *)headWearSvgaImageView {
if (!_headWearSvgaImageView) {
_headWearSvgaImageView = [[SVGAImageView alloc]init];
_headWearSvgaImageView.backgroundColor = [UIColor clearColor];
_headWearSvgaImageView.frame = self.bounds;
_headWearSvgaImageView.userInteractionEnabled = YES;
_headWearSvgaImageView.autoPlay = YES;
}
return _headWearSvgaImageView;
}
@end