Files
peko-ios/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m
eggmanQQQ 479638f16e 修正反馈页内容
修正个播房公告
2024-07-04 15:46:46 +08:00

592 lines
24 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.

//
// XPRoomInfoView.m
// xplan-ios
//
// Created by 冯硕 on 2021/10/11.
//
#import "RoomHeaderView.h"
///Third
#import <NIMSDK/NIMSDK.h>
#import <Masonry/Masonry.h>
#import "TTPopup.h"
#import <FFPopup/FFPopup.h>
#import "HttpRequestHelper.h"
///Tool
#import "UIImage+Utils.h"
#import "UIButton+EnlargeTouchArea.h"
#import "ThemeColor+Room.h"
#import "TTPopup.h"
#import "AccountInfoStorage.h"
#import "HttpRequestHelper.h"
#import "Api+Room.h"
#import "XCCurrentVCStackManager.h"
///Model
#import "RoomInfoModel.h"
#import "UserInfoModel.h"
#import "AttachMentModel.h"
#import "MicroQueueModel.h"
#import "XPRoomRecommendModel.h"
///View
#import "XPShareView.h"
#import "XPRoomTopicAlertView.h"
#import "XPRoomRecommendView.h"
///VC
#import "XPWebViewcontroller.h"
#import "XPRoomOnLineViewController.h"
#import "XPRoomViewController.h"
#import "XPRoomTypeSelectionViewController.h"
#import "XPRoomTopicViewController.h"
@interface RoomHeaderView ()<XCShareViewDelegate, XPRoomRecommendViewDelegate>
///容器
@property (nonatomic,strong) UIStackView *nickStackView;
///
@property (nonatomic,strong) UIStackView *titleStackView;
@property(nonatomic,strong) NetImageView *avatarView;
///房间名字
@property (nonatomic,strong) MarqueeLabel *titleLabel;
///礼物特效
@property (nonatomic,strong) UIImageView *giftEffectImageView;
///锁房标识
@property (nonatomic,strong) UIImageView *lockRoomImageView;
///
@property (nonatomic,strong) UIStackView *onlineStackView;
///id和在线人数
@property (nonatomic,strong) YYLabel *idLabel;
///收藏
@property (nonatomic,strong) UIButton *collectButton;
///分享
@property (nonatomic,strong) UIButton *shareButton;
///设置
@property (nonatomic,strong) UIButton *settingButton;
///话题设置
@property (nonatomic, strong) UIButton *topicButton;
///代理
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
///右侧推荐房间
@property (nonatomic, strong) XPRoomRecommendView *recommendRoomView;
///返回按钮,最小化
@property (nonatomic,strong) UIButton *backBtn;
///是否已发送过收藏房间公屏消息
@property (nonatomic, assign) BOOL hadShowCollectInScreen;
@end
@implementation RoomHeaderView
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
_hostDelegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Event Response
- (void)backButtonAction:(UIButton *)sender {
[self.hostDelegate miniRoom];
}
- (void)shareButtonAction:(UIButton *)sender{
[self showSharePanel];
}
- (void)settingButtonAction:(UIButton *)sender {
self.recommendRoomView.frame = CGRectMake(KScreenWidth, 0, 250, KScreenHeight);
FFPopup *popup = [FFPopup popupWithContentView:self.recommendRoomView];
popup.showType = isMSRTL() ? FFPopupShowType_SlideInFromLeft:FFPopupShowType_SlideInFromRight;
popup.dismissType = isMSRTL() ? FFPopupDismissType_SlideOutToLeft : FFPopupDismissType_SlideOutToRight;
popup.maskType = FFPopupMaskType_Dimmed;
popup.dimmedMaskAlpha = 0.0;
popup.shouldDismissOnBackgroundTouch = YES;
FFPopupHorizontalLayout horizontalLayout = isMSRTL() ? FFPopupHorizontalLayout_Left : FFPopupHorizontalLayout_Right;
FFPopupVerticalLayout verticalLayout = FFPopupVerticalLayout_Center;
[popup showWithLayout:FFPopupLayoutMake(horizontalLayout, verticalLayout) duration:0.0];
@kWeakify(self);
popup.didFinishDismissingBlock = ^{
@kStrongify(self);
[self.recommendRoomView removeFromSuperview];
};
popup.didFinishShowingBlock = ^{
};
[Api reqeustRecommendRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if (code == 200) {
NSArray *array = [XPRoomRecommendModel modelsWithArray:data.data];
self.recommendRoomView.roomList = [NSMutableArray arrayWithArray:array];
}
} roomId:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]];
}
- (void)topicButtonAction:(UIButton *)sender {
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request
completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
if (error== nil) {
NIMChatroomMember* member = members.firstObject;
RoomInfoModel * roomInfo= self.hostDelegate.getRoomInfo;
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
XPRoomTopicViewController * editTopicVC = [[XPRoomTopicViewController alloc] init];
editTopicVC.roomInfo = roomInfo;
[self.hostDelegate.getCurrentNav pushViewController:editTopicVC animated:YES];
} else {
TTPopupService * config = [[TTPopupService alloc] init];
XPRoomTopicAlertView * alertView = [[XPRoomTopicAlertView alloc] init];
alertView.title = roomInfo.roomDesc;
alertView.message = roomInfo.introduction;
config.contentView = alertView;
[TTPopup popupWithConfig:config];
}
}
}];
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.avatarView];
[self addSubview:self.nickStackView];
[self addSubview:self.collectButton];
[self addSubview:self.shareButton];
[self addSubview:self.settingButton];
[self addSubview:self.topicButton];
[self addSubview:self.backBtn];
[self.nickStackView addArrangedSubview:self.titleStackView];
[self.nickStackView addArrangedSubview:self.onlineStackView];
[self.onlineStackView addArrangedSubview:self.idLabel];
[self.titleStackView addArrangedSubview:self.titleLabel];
[self.titleStackView addArrangedSubview:self.giftEffectImageView];
[self.titleStackView addArrangedSubview:self.lockRoomImageView];
}
- (void)initSubViewConstraints {
// 设置
[self.settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-15);
make.bottom.mas_equalTo(-11);
make.width.height.mas_equalTo(22);
}];
[self.topicButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(-45);
make.bottom.mas_equalTo(-11);
make.width.height.mas_equalTo(22);
}];
[self.shareButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.equalTo(self.settingButton.mas_leading).offset(-15);
make.centerY.mas_equalTo(self.settingButton);
make.width.height.mas_equalTo(22);
}];
[self.collectButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.settingButton);
make.leading.equalTo(self.titleStackView.mas_trailing).mas_offset(5);
make.size.mas_equalTo(CGSizeMake(20, 20));
}];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(35);
make.width.height.mas_equalTo(31);
make.centerY.mas_equalTo(self.settingButton);
}];
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.settingButton);
make.leading.equalTo(self.avatarView.mas_trailing).mas_offset(6);
}];
[self.titleStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_greaterThanOrEqualTo(50);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_lessThanOrEqualTo(100);
make.height.mas_equalTo(12);
}];
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(7);
}];
[self.giftEffectImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(10,10));
}];
[self.lockRoomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(20,20));
}];
[self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(15);
make.height.width.mas_equalTo(20);
make.centerY.mas_equalTo(self.settingButton);
}];
}
#pragma mark - RoomGuestDelegate
- (void)onRoomEntered {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
self.idLabel.text = [NSString stringWithFormat:@"ID%ld",(long)roomInfo.erbanNo];
self.avatarView.imageUrl = roomInfo.avatar;
if (roomInfo) {
self.titleLabel.text = roomInfo.title;
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
} else {
self.collectButton.hidden = NO;
self.collectButton.selected = roomInfo.isRoomFans;
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
}
// self.topicButton.hidden = roomInfo.type == RoomType_Anchor;
}
- (void)onRoomUpdate {
RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo;
self.titleLabel.text = roomInfo.title;
self.avatarView.imageUrl = roomInfo.avatar;
self.idLabel.text = [NSString stringWithFormat:@"ID%ld",(long)roomInfo.erbanNo];
self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect;
if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
self.collectButton.hidden = YES;
} else {
self.collectButton.hidden = NO;
// self.collectButton.selected = roomInfo.isRoomFans; 收藏后,房间数据没有及时更新
}
self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0;
self.topicButton.hidden = roomInfo.type == RoomType_Anchor;
}
#pragma mark - Event Response
- (void)showSharePanel {
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
XPShareItem *qq = [XPShareItem itemWitTag:XPShareItemTagCopyLink title:YMLocalizedString(@"RoomHeaderView3") imageName:@"share_copy_link" disableImageName:@"share_copy_link"];
NSArray * items = @[wechat,cycle, qq];
RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo];
XPShareInfoModel * shareInfo = [[XPShareInfoModel alloc] init];
shareInfo.shareTitle = YMLocalizedString(@"RoomHeaderView4");
shareInfo.shareContent = YMLocalizedString(@"RoomHeaderView5");
shareInfo.shareImageUrl = [self.hostDelegate getRoomInfo].avatar;
shareInfo.type = ShareType_Room;
shareInfo.roomUid = roomInfo.uid;
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%ld&room_name=%@&room_id=%ld&room_avatar=%@&share_name=%@",[HttpRequestHelper getHostUrl],URLWithType(kShareRoomURL),uid,roomInfo.uid,roomInfo.title,roomInfo.erbanNo,roomInfo.avatar,roomInfo.nick];
shareInfo.shareUrl = urlString;
CGFloat margin = 15;
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65);
XPShareView *shareView = [[XPShareView alloc] initWithItems:items itemSize:itemSize shareInfo:shareInfo];
shareView.delegate = self;
[TTPopup popupView:shareView style:TTPopupStyleActionSheet];
}
///保存一下分享的内容的 不需要处理错误码
- (void)saveShare:(XPShareInfoModel *)shareInfo {
NSMutableDictionary *params = [NSMutableDictionary dictionary];
NSString *uid = [AccountInfoStorage instance].getUid;
NSString *ticket = [AccountInfoStorage instance].getTicket;
[params setObject:uid forKey:@"uid"];
[params setObject:@(shareInfo.shareType) forKey:@"shareType"];
[params setObject:ticket forKey:@"ticket"];
[params setObject:@(shareInfo.type) forKey:@"sharePageId"];
if (shareInfo.shareUrl.length > 0) {
[params setObject:shareInfo.shareUrl forKey:@"shareUrl"];
}
if (shareInfo.roomUid > 0) {
[params setObject:@(shareInfo.roomUid) forKey:@"targetUid"];
}
[HttpRequestHelper POST:@"usershare/save" params:params success:^(BaseModel * _Nonnull data) {
NSLog(@"%@",data);
} failure:^(NSInteger resCode, NSString * _Nonnull message) {
}];
}
- (void)collectButtonAction:(UIButton *)sender {
NSString * type = self.collectButton.selected ? @"2" : @"1";
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
@kWeakify(self);
[Api collectRoom:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@kStrongify(self);
if (code == 200) {
self.collectButton.selected = !self.collectButton.selected;
if ([type isEqualToString:@"1"]) {///收藏的话
[XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"RoomHeaderView6")];
if (self.hadShowCollectInScreen) {
return;
}
self.hadShowCollectInScreen = YES;
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:[AccountInfoStorage instance].getUid forKey:@"uid"];
[dic setValue:self.hostDelegate.getUserInfo.nick forKey:@"nick"];
[dic setValue:[NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid] forKey:@"targetUid"];
[dic setValue:self.hostDelegate.getRoomInfo.nick forKey:@"targetNick"];
NSDictionary * data = @{@"data":dic};
AttachmentModel *attachment = [[AttachmentModel alloc]init];
attachment.first = CustomMessageType_Collection_Room;
attachment.second = Custom_Message_Sub_Collect_Room_Tips;
attachment.data = data;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
NSString *sessionId = [NSString stringWithFormat:@"%ld",self.hostDelegate.getRoomInfo.roomId];
//构造会话
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
}
} else {
[XNDJTDDLoadingTool showErrorWithMessage:msg];
}
} roomUid:roomUid uid:uid type:type roomUids:nil];
}
#pragma mark - XCShareViewDelegate
- (void)shareView:(XPShareView *)shareView shareFail:(NSString *)message {
[TTPopup dismiss];
[XNDJTDDLoadingTool showErrorWithMessage:message];
}
- (void)shareView:(XPShareView *)shareView didSuccess:(XPShareInfoModel *)shareInfo{
[TTPopup dismiss];
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"RoomHeaderView7")];
AttachmentModel * attachMent = [[AttachmentModel alloc] init];
attachMent.first = CustomMessageType_Room_Tip;
attachMent.second = Custom_Message_Sub_Room_Tip_ShareRoom;
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
NSString * uid = [AccountInfoStorage instance].getUid;
[dic setValue:uid forKey:@"uid"];
NSMutableDictionary * userDic = [NSMutableDictionary dictionary];
UserInfoModel * userInfo = [self.hostDelegate getUserInfo];
RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo];
[userDic setValue:roomInfo.nick.length > 0 ? roomInfo.nick : @"" forKey:@"targetNick"];
[userDic setValue:@(roomInfo.uid) forKey:@"targetUid"];
[userDic setValue:userInfo.nick.length > 0 ? userInfo.nick : @"" forKey:@"nick"];
[dic setValue:userDic forKey:@"data"];
attachMent.data = dic;
NSString *sessionID = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].roomId];
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachMent;
message.messageObject = object;
//构造会话
NIMSession *session = [NIMSession session:sessionID type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
///上报一下
[self saveShare:shareInfo];
}
- (void)shareViewDidClickCancel:(XPShareView *)shareView {
[TTPopup dismiss];
}
#pragma mark - XPRoomRecommendViewDelegate
- (void)xPRoomRecommendViewReport {
TTActionSheetConfig *action = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView10") clickAction:^{
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate requesstShieldingAction];
}];
TTActionSheetConfig *action1 = [TTActionSheetConfig normalTitle:YMLocalizedString(@"RoomHeaderView12") clickAction:^{
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
XPWebViewController * webVC = [[XPWebViewController alloc] init];
NSString *urlstr = [NSString stringWithFormat:@"%@?reportUid=%ld&source=ROOM", URLWithType(kReportRoomURL),self.hostDelegate.getRoomInfo.uid];
webVC.url = urlstr;
[[self.hostDelegate getCurrentNav] pushViewController:webVC animated:YES];
}];
[TTPopup actionSheetWithItems:@[action,action1]];
}
- (void)xPRoomRecommendViewMiniRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate miniRoom];
}
- (void)xPRoomRecommendViewExitRoom {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
}
- (void)xPRoomRecommendViewJumpToRoom:(NSString *)roomUid {
[FFPopup dismissPopupForView:self.recommendRoomView animated:NO];
[self.hostDelegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
#pragma mark - Getters And Setters
- (UIButton *)shareButton {
if(!_shareButton){
_shareButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_shareButton setImage:[UIImage imageNamed:@"room_info_share"] forState:UIControlStateNormal];
[_shareButton addTarget:self action:@selector(shareButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_shareButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
_shareButton.hidden = YES;
}
return _shareButton;
}
- (UIButton *)settingButton {
if (!_settingButton) {
_settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_settingButton setImage:[UIImage imageNamed:@"room_info_setting"] forState:UIControlStateNormal];
[_settingButton addTarget:self action:@selector(settingButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_settingButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
}
return _settingButton;
}
- (UIButton *)topicButton {
if (!_topicButton) {
_topicButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_topicButton setImage:[UIImage imageNamed:@"room_header_topic_icon"] forState:UIControlStateNormal];
[_topicButton addTarget:self action:@selector(topicButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_topicButton setEnlargeEdgeWithTop:8 right:8 bottom:8 left:8];
}
return _topicButton;
}
- (UIButton *)collectButton {
if (!_collectButton) {
_collectButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_collectButton setImage:kImage(@"ms_room_top_no_collect") forState:UIControlStateNormal];
[_collectButton setImage:kImage(@"ms_room_top_collect") forState:UIControlStateSelected];
_collectButton.hidden = YES;
[_collectButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
[_collectButton addTarget:self action:@selector(collectButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _collectButton;
}
- (UIStackView *)nickStackView {
if (!_nickStackView) {
_nickStackView = [[UIStackView alloc] init];
_nickStackView.axis = UILayoutConstraintAxisVertical;
_nickStackView.distribution = UIStackViewDistributionFill;
_nickStackView.alignment = UIStackViewAlignmentLeading;
_nickStackView.spacing = 4;
}
return _nickStackView;
}
- (UIStackView *)titleStackView {
if (!_titleStackView) {
_titleStackView = [[UIStackView alloc] init];
_titleStackView.axis = UILayoutConstraintAxisHorizontal;
_titleStackView.distribution = UIStackViewDistributionFill;
_titleStackView.alignment = UIStackViewAlignmentCenter;
_titleStackView.spacing = 5;
}
return _titleStackView;
}
- (MarqueeLabel *)titleLabel{
if (!_titleLabel) {
_titleLabel = [[MarqueeLabel alloc] init];
_titleLabel.scrollDuration = 8.0;
_titleLabel.fadeLength = 6.0f;
_titleLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightBold];
_titleLabel.textColor = UIColorFromRGB(0xEFEBF3);
_titleLabel.userInteractionEnabled = YES;
}
return _titleLabel;
}
- (UIImageView *)giftEffectImageView {
if (!_giftEffectImageView) {
_giftEffectImageView = [[UIImageView alloc] init];
_giftEffectImageView.userInteractionEnabled = YES;
_giftEffectImageView.image = [UIImage imageNamed:@"room_info_gift_effect"];
_giftEffectImageView.hidden = YES;
}
return _giftEffectImageView;
}
- (UIImageView *)lockRoomImageView {
if (!_lockRoomImageView) {
_lockRoomImageView = [[UIImageView alloc] init];
_lockRoomImageView.userInteractionEnabled = YES;
_lockRoomImageView.image = [UIImage imageNamed:@"room_info_lock_room"];
_lockRoomImageView.hidden = YES;
}
return _lockRoomImageView;
}
- (UIStackView *)onlineStackView {
if (!_onlineStackView) {
_onlineStackView = [[UIStackView alloc] init];
_onlineStackView.axis = UILayoutConstraintAxisHorizontal;
_onlineStackView.distribution = UIStackViewDistributionFill;
_onlineStackView.alignment = UIStackViewAlignmentCenter;
_onlineStackView.spacing = 2;
}
return _onlineStackView;
}
- (YYLabel *)idLabel {
if (!_idLabel) {
_idLabel = [[YYLabel alloc] init];
_idLabel.textColor = [UIColor whiteColor];
_idLabel.font = [UIFont systemFontOfSize:9 weight:UIFontWeightBold];
}
return _idLabel;
}
- (XPRoomRecommendView *)recommendRoomView {
if (!_recommendRoomView) {
_recommendRoomView = [[XPRoomRecommendView alloc] init];
self.recommendRoomView.delegate = self;
}
return _recommendRoomView;
}
- (UIButton *)backBtn{
if (!_backBtn){
_backBtn = [UIButton new];
[_backBtn setBackgroundImage:[[UIImage imageNamed:@"common_nav_back_white"] ms_SetImageForRTL] forState:UIControlStateNormal];
[_backBtn addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
// [_backBtn setCornerWithLeftTopCorner:10 rightTopCorner:10 bottomLeftCorner:10 bottomRightCorner:10 size:CGSizeMake(20,20)];
[_backBtn setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
}
return _backBtn;
}
- (NetImageView *)avatarView{
if(!_avatarView){
NetImageConfig *config = [NetImageConfig new];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarView = [[NetImageView alloc]initWithConfig:config];
_avatarView.layer.cornerRadius = 31/2;
_avatarView.layer.masksToBounds = YES;
_avatarView.layer.borderWidth = 1;
_avatarView.layer.borderColor = [UIColor whiteColor].CGColor;
}
return _avatarView;
}
@end