增加换肤功能
This commit is contained in:
32
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.h
Normal file
32
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// QXRoomRankSubView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomRankSubView : UIView<JXCategoryListContentViewDelegate>
|
||||
@property (nonatomic,strong)NSString*roomId;
|
||||
@property (nonatomic,strong)NSString*type;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXRoomRankTopThreeView :UIView
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
@property (nonatomic,strong)UIImageView *borderImageView;
|
||||
@property (nonatomic,strong)UILabel *onlineLabel;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,strong)UIView *iconBgView;
|
||||
|
||||
@property (nonatomic,strong)UIButton *rankBtn;
|
||||
|
||||
@property (nonatomic,assign)NSInteger number;
|
||||
|
||||
@property (nonatomic,strong)QXRoomOnlineList*md;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
397
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.m
Normal file
397
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankSubView.m
Normal file
@@ -0,0 +1,397 @@
|
||||
//
|
||||
// QXRoomRankSubView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomRankSubView.h"
|
||||
#import "QXBlackListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRoomRankSubView()<UITableViewDataSource,UITableViewDelegate>
|
||||
@property (nonatomic,strong)UIView *topBgView;
|
||||
@property (nonatomic,strong)UIButton *hourBtn;
|
||||
@property (nonatomic,strong)UIButton *dayBtn;
|
||||
@property (nonatomic,strong)UIButton *weekBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
|
||||
@property (nonatomic,strong)UIView *tableHeaderView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *firstView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *secondView;
|
||||
@property (nonatomic,strong)QXRoomRankTopThreeView *thirdView;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *topArray;
|
||||
@property (nonatomic,assign)NSInteger page;
|
||||
@end
|
||||
@implementation QXRoomRankSubView
|
||||
|
||||
-(UIView *)listView{
|
||||
return self;
|
||||
}
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.page = 1;
|
||||
self.topBgView = [[UIView alloc] initWithFrame:CGRectMake(16, 8, self.width-32, 40)];
|
||||
self.topBgView.backgroundColor = RGB16(0x2B2482);
|
||||
[self.topBgView addRoundedCornersWithRadius:20];
|
||||
[self addSubview:self.topBgView];
|
||||
|
||||
|
||||
self.hourBtn = [[UIButton alloc] init];
|
||||
[self.hourBtn setTitle:QXText(@"小时榜") forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.hourBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.hourBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.hourBtn addRoundedCornersWithRadius:15];
|
||||
self.hourBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.hourBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
|
||||
[self.topBgView addSubview:self.hourBtn];
|
||||
|
||||
self.dayBtn = [[UIButton alloc] init];
|
||||
[self.dayBtn setTitle:QXText(@"日榜") forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.dayBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.dayBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.dayBtn addRoundedCornersWithRadius:15];
|
||||
self.dayBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.dayBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.topBgView addSubview:self.dayBtn];
|
||||
|
||||
self.weekBtn = [[UIButton alloc] init];
|
||||
[self.weekBtn setTitle:QXText(@"周榜") forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setBackgroundImage:[UIImage imageWithColor:[UIColor whiteColor]] forState:(UIControlStateSelected)];
|
||||
[self.weekBtn setTitleColor:RGB16(0xACA3ED) forState:(UIControlStateNormal)];
|
||||
[self.weekBtn setTitleColor:QXConfig.textColor forState:(UIControlStateSelected)];
|
||||
[self.weekBtn addRoundedCornersWithRadius:15];
|
||||
self.weekBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
[self.weekBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.topBgView addSubview:self.weekBtn];
|
||||
|
||||
CGFloat btnWidth = ScaleWidth(72);
|
||||
|
||||
[self.dayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.topBgView);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
[self.hourBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.dayBtn.mas_left).offset(-16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
[self.weekBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.dayBtn.mas_right).offset(16);
|
||||
make.height.mas_equalTo(30);
|
||||
make.width.mas_equalTo(btnWidth);
|
||||
make.centerY.equalTo(self.topBgView);
|
||||
}];
|
||||
|
||||
self.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topBgView.bottom+38, self.width, 220)];
|
||||
CGFloat itemWidth = (self.width-36)/3;
|
||||
|
||||
|
||||
self.secondView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(18, 50, itemWidth, 135)];
|
||||
self.secondView.number = 2;
|
||||
[self.tableHeaderView addSubview:self.secondView];
|
||||
|
||||
|
||||
self.firstView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.secondView.right, 0, itemWidth, 161)];
|
||||
self.firstView.number = 1;
|
||||
[self.tableHeaderView addSubview:self.firstView];
|
||||
|
||||
self.thirdView = [[QXRoomRankTopThreeView alloc] initWithFrame:CGRectMake(self.firstView.right, 50, itemWidth, 135)];
|
||||
self.thirdView.number = 3;
|
||||
[self.tableHeaderView addSubview:self.thirdView];
|
||||
[self addSubview:self.tableHeaderView];
|
||||
|
||||
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.tableHeaderView.bottom, self.width, self.height-self.tableHeaderView.bottom) style:(UITableViewStylePlain)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.tableView.rowHeight = 60;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
MJWeakSelf
|
||||
self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getRankList];
|
||||
}];
|
||||
self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getRankList];
|
||||
}];
|
||||
[self addSubview:self.tableView];
|
||||
|
||||
// self.tableView.tableHeaderView = self.tableHeaderView;
|
||||
|
||||
self.hourBtn.selected = YES;
|
||||
self.selectedBtn = self.hourBtn;
|
||||
}
|
||||
-(void)setRoomId:(NSString *)roomId{
|
||||
_roomId = roomId;
|
||||
self.page = 1;
|
||||
[self getRankList];
|
||||
}
|
||||
-(void)getRankList{
|
||||
NSString *time_type = @"1";
|
||||
if (self.selectedBtn == self.hourBtn) {
|
||||
time_type = @"1";
|
||||
}else if(self.selectedBtn == self.dayBtn){
|
||||
time_type = @"2";
|
||||
}else if(self.selectedBtn == self.weekBtn){
|
||||
time_type = @"3";
|
||||
}
|
||||
|
||||
MJWeakSelf
|
||||
[QXMineNetwork roomRankListWithRoomId:self.roomId type:self.type time_type:time_type page:self.page successBlock:^(NSArray<QXRoomOnlineList *> * _Nonnull list) {
|
||||
if (weakSelf.page == 1) {
|
||||
weakSelf.firstView.md = nil;
|
||||
weakSelf.secondView.md = nil;
|
||||
weakSelf.thirdView.md = nil;
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
[weakSelf.topArray removeAllObjects];
|
||||
for (int i = 0 ; i < list.count; i++) {
|
||||
QXRoomOnlineList*md = list[i];
|
||||
if (i == 0) {
|
||||
// [weakSelf.topArray addObject:md];
|
||||
weakSelf.firstView.md = md;
|
||||
}else if (i == 1) {
|
||||
weakSelf.secondView.md = md;
|
||||
}else if (i == 2) {
|
||||
weakSelf.thirdView.md = md;
|
||||
}else{
|
||||
[weakSelf.dataArray addObject:md];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
if (list.count == 0) {
|
||||
self.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)typeAction:(UIButton*)sender{
|
||||
self.selectedBtn.selected = !self.selectedBtn.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.selectedBtn = sender;
|
||||
[self getRankList];
|
||||
}
|
||||
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
cell.cellType = QXBlackListCellTypeRank;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
cell.titleLabel.text = [NSString stringWithFormat:@"%ld",indexPath.row+4];
|
||||
cell.rankModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)topArray{
|
||||
if (!_topArray) {
|
||||
_topArray = [NSMutableArray array];
|
||||
}
|
||||
return _topArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXRoomRankTopThreeView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setNumber:(NSInteger)number{
|
||||
_number = number;
|
||||
if (number == 1) {
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_first"];
|
||||
}else if(number == 2){
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_second"];
|
||||
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
}];
|
||||
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
}else{
|
||||
self.borderImageView.image = [UIImage imageNamed:@"room_rank_third"];
|
||||
[self.headerImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
}];
|
||||
[self.borderImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
[self.nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(12);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
}
|
||||
}
|
||||
-(void)setMd:(QXRoomOnlineList *)md{
|
||||
_md = md;
|
||||
if (md == nil) {
|
||||
self.headerImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
||||
self.nameLabel.text = @"虚位以待";
|
||||
[self.rankBtn setTitle:@"0" forState:(UIControlStateNormal)];
|
||||
[self.iconBgView removeAllSubviews];
|
||||
return;
|
||||
}
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
self.nameLabel.text = md.nickname?md.nickname:@"";
|
||||
[self.iconBgView removeAllSubviews];
|
||||
[self.rankBtn setTitle:[NSString stringWithFormat:@" %@",md.total?md.total:md.gift_prices] forState:(UIControlStateNormal)];
|
||||
CGFloat iconWidth = 38;
|
||||
CGFloat iconHeight = 16;
|
||||
CGFloat margin = 6;
|
||||
for (int i = 0 ; i < md.icon.count; i++) {
|
||||
UIImageView *iconImageView = [[UIImageView alloc] init];
|
||||
[iconImageView sd_setImageWithURL:[NSURL URLWithString:md.icon[i]]];
|
||||
[self.iconBgView addSubview:iconImageView];
|
||||
if (md.icon.count == 1) {
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.centerX.equalTo(self.iconBgView);
|
||||
}];
|
||||
}else if(md.icon.count == 2){
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
make.centerX.equalTo(self.iconBgView).offset(-38/2+(margin+iconWidth)*i);
|
||||
}];
|
||||
}else{
|
||||
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(i*(iconWidth+margin));
|
||||
make.width.mas_equalTo(iconWidth);
|
||||
make.height.mas_equalTo(iconHeight);
|
||||
make.centerY.equalTo(self.iconBgView);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
[self.headerImageView addRoundedCornersWithRadius:32];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self addSubview:self.headerImageView];
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(10);
|
||||
make.size.mas_equalTo(CGSizeMake(64, 64));
|
||||
}];
|
||||
|
||||
self.borderImageView = [[UIImageView alloc] init];
|
||||
self.borderImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.borderImageView];
|
||||
[self.borderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self.headerImageView);
|
||||
make.size.mas_equalTo(CGSizeMake(80, 80));
|
||||
}];
|
||||
|
||||
self.onlineLabel = [[UILabel alloc] init];
|
||||
self.onlineLabel.textColor = UIColor.whiteColor;
|
||||
self.onlineLabel.font = [UIFont systemFontOfSize:10];
|
||||
self.onlineLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.onlineLabel.backgroundColor = RGB16(0x472ABF);
|
||||
[self.onlineLabel addRoundedCornersWithRadius:7];
|
||||
self.onlineLabel.text = QXText(@"在线");
|
||||
[self addSubview:self.onlineLabel];
|
||||
[self.onlineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.bottom.equalTo(self.borderImageView);
|
||||
make.height.mas_equalTo(14);
|
||||
make.width.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = [UIColor whiteColor];
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.nameLabel.text = QXText(@"虚位以待");
|
||||
self.nameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.nameLabel];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.borderImageView.mas_bottom).offset(25);
|
||||
make.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
|
||||
self.iconBgView = [[UIView alloc] init];
|
||||
[self addSubview:self.iconBgView];
|
||||
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self.nameLabel.mas_bottom);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
self.rankBtn = [[UIButton alloc] init];
|
||||
[self.rankBtn setImage:[UIImage imageNamed:@"room_rank_value_icon"] forState:(UIControlStateNormal)];
|
||||
[self.rankBtn setTitle:@" 0" forState:(UIControlStateNormal)];
|
||||
self.rankBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.rankBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
||||
[self addSubview:self.rankBtn];
|
||||
[self.rankBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.equalTo(self.iconBgView.mas_bottom);
|
||||
make.height.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
17
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.h
Normal file
17
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXRoomRankView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRoomRankView : UIView
|
||||
@property (nonatomic,strong)NSString*roomId;
|
||||
-(void)showInView:(UIView *)view;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
105
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.m
Normal file
105
QXLive/HomePage(声播)/View/房间/排行榜/QXRoomRankView.m
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// QXRoomRankView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomRankView.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomRankSubView.h"
|
||||
|
||||
@interface QXRoomRankView()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate,UIGestureRecognizerDelegate>
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@end
|
||||
@implementation QXRoomRankView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, SCREEN_HEIGHT-ScaleWidth(144))];
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_rank_bg"]];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
self.bgImageView.frame = self.bgView.bounds;
|
||||
[self.bgView addSubview:self.bgImageView];
|
||||
|
||||
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake((self.width-140)/2,0,140, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = @[QXText(@"财富榜"),QXText(@"魅力榜")];
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#ffffff"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#DADADA"];
|
||||
self.categoryView.cellWidth = 66;
|
||||
self.categoryView.cellSpacing = 0;
|
||||
self.categoryView.contentEdgeInsetLeft = 8;
|
||||
// self.categoryView.titleLabelZoomScale = 1.1;
|
||||
self.categoryView.titleLabelZoomEnabled = YES;
|
||||
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
|
||||
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
||||
// self.categoryView.averageCellSpacingEnabled = YES;
|
||||
// JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
||||
// indicatorView.indicatorImageView.image = [[UIImage imageNamed:@"home_slider"] imageByTintColor:[UIColor whiteColor]];
|
||||
// indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
|
||||
// indicatorView.verticalMargin = 11;
|
||||
// self.categoryView.indicators = @[indicatorView];
|
||||
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
||||
self.containerView.frame = CGRectMake(0, 44, self.width, self.height-ScaleWidth(144)-44);
|
||||
[self.bgView addSubview:self.categoryView];
|
||||
[self.bgView addSubview:self.containerView];
|
||||
self.categoryView.listContainer = self.containerView;
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = ScaleWidth(144);
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXRoomRankSubView *vc = [[QXRoomRankSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height-ScaleWidth(144)-44)];
|
||||
if (index == 0) {
|
||||
vc.type = @"1";
|
||||
}else{
|
||||
vc.type = @"2";
|
||||
}
|
||||
vc.roomId = self.roomId;
|
||||
return vc;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user