房间UI优化

This commit is contained in:
chenguilong
2022-04-27 18:05:46 +08:00
parent 63138e62ca
commit f3ff5c5ba7
29 changed files with 392 additions and 86 deletions

View File

@@ -61,6 +61,7 @@
#import "AcrossRoomPKPrizeModel.h"
#import "XPRoomTrumpetView.h"
#import "XPMineUserInfoViewController.h"
#import "XPRoomRankEntranceView.h"
///PK
#import "XPAnchorFansTeamEntranceView.h"
#import "XPAnchorFansTeamViewController.h"
@@ -72,7 +73,7 @@
///host
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
///
@property (nonatomic,strong) UIButton *contributionButton;
@property (nonatomic,strong) XPRoomRankEntranceView *contributeEnterView;
///
@property (nonatomic,strong) UIButton *datingProgresButton;
///
@@ -147,36 +148,35 @@
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.contributionButton];
[self addSubview:self.contributeEnterView];
[self addSubview:self.anchorHourRankButton];
[self addSubview:self.anchorGiftValueView];
[self addSubview:self.topicStackView];
[self addSubview:self.fansTeamEntranceView];
// [self addSubview:self.trumpetView];
[self.topicStackView addArrangedSubview:self.topicLabel];
[self.topicStackView addArrangedSubview:self.editButton];
}
- (void)initSubViewConstraints {
[self.contributionButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(-12);
make.top.mas_equalTo(kNavigationHeight);
make.width.mas_equalTo(90);
make.height.mas_equalTo(26);
[self.contributeEnterView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.top.mas_equalTo(kNavigationHeight+4);
make.width.mas_equalTo(116);
make.height.mas_equalTo(22);
}];
[self.anchorHourRankButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(11);
make.centerY.mas_equalTo(self.contributionButton);
make.centerY.mas_equalTo(self.contributeEnterView);
make.width.mas_equalTo(67);
make.height.mas_equalTo(22);
}];
[self.anchorGiftValueView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contributionButton.mas_right).mas_offset(8);
make.centerY.mas_equalTo(self.contributionButton);
make.left.mas_equalTo(self.contributeEnterView.mas_right).mas_offset(8);
make.centerY.mas_equalTo(self.contributeEnterView);
make.height.mas_equalTo(26);
}];
[self.fansTeamEntranceView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.contributionButton.mas_bottom).mas_offset(5);
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(5);
make.left.mas_equalTo(0);
make.height.mas_equalTo(37);
}];
@@ -185,12 +185,6 @@
make.height.mas_equalTo(15);
make.top.mas_equalTo(58 + 5 + 6 + 12 + 3 + kNavigationHeight);
}];
// [self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(kNavigationHeight);
// make.left.mas_equalTo(0);
// make.right.mas_equalTo(0);
// make.height.mas_equalTo(152.5);
// }];
}
- (void)showLittleGameMiniView:(RoomType)type {
@@ -304,16 +298,14 @@
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
self.contributeEnterView.title = @"主播榜";
self.contributeEnterView.array = @[];
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
self.fansTeamEntranceView.hidden = NO;
self.anchorHourRankButton.hidden = NO;
if (!roomInfo.showGiftValue) {
self.anchorGiftValueView.giftValue = 0;
}
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(statusbarHeight+49);
}];
if (roomInfo.hadChangeRoomType) {
///
[Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@@ -322,13 +314,11 @@
} teamUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
}
} else {
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
self.contributeEnterView.title = @"房间榜";
self.contributeEnterView.array = @[];
self.anchorGiftValueView.hidden = YES;
self.fansTeamEntranceView.hidden = YES;
self.anchorHourRankButton.hidden = YES;
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kNavigationHeight);
}];
}
[self updateRoomTopic];
[self showLittleGameMiniView:roomInfo.type];
@@ -390,20 +380,16 @@
} roomUid:roomUid];
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
self.contributeEnterView.title = @"主播榜";
self.contributeEnterView.array = @[];
self.anchorGiftValueView.hidden = !roomInfo.showGiftValue;
if (!roomInfo.showGiftValue) {
self.anchorGiftValueView.giftValue = 0;
}
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(statusbarHeight+49);
}];
} else {
[self.contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
self.contributeEnterView.title = @"房间榜";
self.contributeEnterView.array = @[];
self.anchorGiftValueView.hidden = YES;
[self.contributionButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kNavigationHeight);
}];
}
[self updateRoomTopic];
@@ -796,7 +782,7 @@
}
#pragma mark - Event Response
- (void)contributionButtonAction:(UIButton *)sender {
- (void)contributionButtonAction:(UITapGestureRecognizer *)tap {
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kRoomRankURL), roomUid];
@@ -1229,21 +1215,30 @@
}
#pragma mark - Getters And Setters
- (UIButton *)contributionButton {
if (!_contributionButton) {
_contributionButton = [[UIButton alloc]init];
[_contributionButton addTarget:self action:@selector(contributionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_contributionButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
[_contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
[_contributionButton setImage:[UIImage imageNamed:@"room_rank_enter_icon"] forState:UIControlStateNormal];
[_contributionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_contributionButton.titleLabel.font = [UIFont systemFontOfSize:12];
_contributionButton.layer.cornerRadius = 13;
_contributionButton.layer.masksToBounds = YES;
_contributionButton.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
_contributionButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
}
return _contributionButton;
//- (UIButton *)contributionButton {
// if (!_contributionButton) {
// _contributionButton = [[UIButton alloc]init];
// [_contributionButton addTarget:self action:@selector(contributionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
// _contributionButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
// [_contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
// [_contributionButton setImage:[UIImage imageNamed:@"room_rank_enter_icon"] forState:UIControlStateNormal];
// [_contributionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// _contributionButton.titleLabel.font = [UIFont systemFontOfSize:12];
// _contributionButton.layer.cornerRadius = 13;
// _contributionButton.layer.masksToBounds = YES;
// _contributionButton.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
// _contributionButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
// }
// return _contributionButton;
//}
- (XPRoomRankEntranceView *)contributeEnterView {
if (!_contributeEnterView) {
_contributeEnterView = [[XPRoomRankEntranceView alloc] init];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(contributionButtonAction:)];
[_contributeEnterView addGestureRecognizer:tap];
}
return _contributeEnterView;
}
- (UIButton *)anchorHourRankButton {
@@ -1366,7 +1361,6 @@
- (XPRoomTrumpetView *)trumpetView {
if (!_trumpetView) {
_trumpetView = [[XPRoomTrumpetView alloc] init];
// _trumpetView.hidden = YES;
}
return _trumpetView;
}