提交
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#import "QXRechargePermissionModel.h"
|
||||
#import "QXNiceGiftPopView.h" // 天降好礼
|
||||
#import "QXFirstRechargeView.h" // 首充好礼
|
||||
#import "QXHomeTopView.h"
|
||||
|
||||
@interface QXHomeViewController ()<JXPagerViewDelegate,JXCategoryViewDelegate,GKCycleScrollViewDataSource,GKCycleScrollViewDelegate,QXGiftScrollViewDelegate,SDCycleScrollViewDelegate>
|
||||
@property (nonatomic, strong) JXPagerView *pagingView;
|
||||
@@ -32,7 +33,8 @@
|
||||
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
||||
@property (nonatomic,strong)NSMutableArray *titles;
|
||||
@property (nonatomic,strong)NSArray *titleModelArray;
|
||||
@property (nonatomic,strong)GKCycleScrollView *cycleScrollView;
|
||||
//@property (nonatomic,strong)GKCycleScrollView *cycleScrollView;
|
||||
@property (nonatomic,strong)QXHomeTopView *topView;
|
||||
@property (nonatomic,strong)JXCategoryIndicatorImageView *indicatorView;
|
||||
@property (nonatomic,strong)UIButton *rankRightBtn;
|
||||
@property (nonatomic,strong)UIButton *searchRightBtn;
|
||||
@@ -84,28 +86,28 @@
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
[self.view addSubview:self.rankRightBtn];
|
||||
// [self.view addSubview:self.rankRightBtn];
|
||||
[self.view addSubview:self.searchRightBtn];
|
||||
[self.view addSubview:self.roomBtn];
|
||||
|
||||
[self.roomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(54);
|
||||
make.height.mas_equalTo(26);
|
||||
// [self.view addSubview:self.roomBtn];
|
||||
//
|
||||
// [self.roomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.width.mas_equalTo(54);
|
||||
// make.height.mas_equalTo(26);
|
||||
// make.centerY.equalTo(logoImageView);
|
||||
// make.right.equalTo(self.view).offset(-10);
|
||||
// }];
|
||||
//
|
||||
// [self.rankRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.right.equalTo(self.roomBtn.mas_left).offset(-10);
|
||||
// make.centerY.equalTo(self.roomBtn);
|
||||
// make.width.height.mas_equalTo(32);
|
||||
// }];
|
||||
//
|
||||
[self.searchRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(32);
|
||||
make.centerY.equalTo(logoImageView);
|
||||
make.right.equalTo(self.view).offset(-10);
|
||||
}];
|
||||
|
||||
[self.rankRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.roomBtn.mas_left).offset(-10);
|
||||
make.centerY.equalTo(self.roomBtn);
|
||||
make.width.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
[self.searchRightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.rankRightBtn.mas_left).offset(-10);
|
||||
make.centerY.equalTo(self.roomBtn);
|
||||
make.width.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
|
||||
self.listVCArray = [NSMutableArray array];
|
||||
@@ -399,7 +401,7 @@
|
||||
self.appStoreView.hidden = YES;
|
||||
}
|
||||
// weakSelf.appStoreView.dataArray = list;
|
||||
[self.cycleScrollView reloadData];
|
||||
[self.topView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
@@ -568,15 +570,15 @@
|
||||
}
|
||||
-(UIView *)headerView{
|
||||
if (!_headerView) {
|
||||
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.cycleScrollView.height+self.bannerScrollView.height+10)];
|
||||
[_headerView addSubview:self.cycleScrollView];
|
||||
_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, self.topView.height+self.bannerScrollView.height+10)];
|
||||
[_headerView addSubview:self.topView];
|
||||
[_headerView addSubview:self.bannerScrollView];
|
||||
}
|
||||
return _headerView;
|
||||
}
|
||||
-(SDCycleScrollView *)bannerScrollView{
|
||||
if (!_bannerScrollView) {
|
||||
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, self.cycleScrollView.bottom+10, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
|
||||
_bannerScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(16, self.topView.bottom+10, SCREEN_WIDTH-32, ScaleWidth(95)) delegate:self placeholderImage:nil];
|
||||
_bannerScrollView.backgroundColor = [UIColor clearColor];
|
||||
_bannerScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
[_bannerScrollView addRoundedCornersWithRadius:8] ;
|
||||
@@ -584,22 +586,28 @@
|
||||
}
|
||||
return _bannerScrollView;
|
||||
}
|
||||
-(GKCycleScrollView *)cycleScrollView{
|
||||
if (!_cycleScrollView) {
|
||||
_cycleScrollView = [[GKCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 155)];
|
||||
_cycleScrollView.dataSource = self;
|
||||
_cycleScrollView.delegate = self;
|
||||
_cycleScrollView.minimumCellAlpha = 0.0;
|
||||
_cycleScrollView.leftRightMargin = 16.0f;
|
||||
_cycleScrollView.topBottomMargin = 15.0f;
|
||||
_cycleScrollView.isInfiniteLoop = YES;
|
||||
_cycleScrollView.isAutoScroll = YES;
|
||||
//-(GKCycleScrollView *)cycleScrollView{
|
||||
// if (!_cycleScrollView) {
|
||||
// _cycleScrollView = [[GKCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 155)];
|
||||
// _cycleScrollView.dataSource = self;
|
||||
// _cycleScrollView.delegate = self;
|
||||
// _cycleScrollView.minimumCellAlpha = 0.0;
|
||||
// _cycleScrollView.leftRightMargin = 16.0f;
|
||||
// _cycleScrollView.topBottomMargin = 15.0f;
|
||||
// _cycleScrollView.isInfiniteLoop = YES;
|
||||
// _cycleScrollView.isAutoScroll = YES;
|
||||
// }
|
||||
// return _cycleScrollView;
|
||||
//}
|
||||
-(QXHomeTopView *)topView{
|
||||
if (!_topView) {
|
||||
_topView = [[QXHomeTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(184))];
|
||||
}
|
||||
return _cycleScrollView;
|
||||
return _topView;
|
||||
}
|
||||
-(QXGiftScrollView *)giftScrollView{
|
||||
if (!_giftScrollView) {
|
||||
_giftScrollView = [[QXGiftScrollView alloc] initWithFrame:CGRectMake(16, self.cycleScrollView.bottom, SCREEN_WIDTH-32, 36)];
|
||||
_giftScrollView = [[QXGiftScrollView alloc] initWithFrame:CGRectMake(16, self.topView.bottom+12, SCREEN_WIDTH-32, 36)];
|
||||
_giftScrollView.delegate = self;
|
||||
}
|
||||
return _giftScrollView;
|
||||
@@ -616,21 +624,7 @@
|
||||
}
|
||||
return _bannerArry;
|
||||
}
|
||||
//-(UIButton *)firstRechargeBtn{
|
||||
// if (!_firstRechargeBtn) {
|
||||
// _firstRechargeBtn = [[UIButton alloc] init];
|
||||
// [_firstRechargeBtn setBackgroundImage:[UIImage imageNamed:@"first_recharge_icon"] forState:(UIControlStateNormal)];
|
||||
// [_firstRechargeBtn addTarget:self action:@selector(firstAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
// }
|
||||
// return _firstRechargeBtn;
|
||||
//}
|
||||
//-(UIButton *)skyDownBtn{
|
||||
// if (!_skyDownBtn) {
|
||||
// _skyDownBtn = [[UIButton alloc] init];
|
||||
// [_skyDownBtn setBackgroundImage:[UIImage imageNamed:@"sky_down_gift_icon"] forState:(UIControlStateNormal)];
|
||||
// }
|
||||
// return _skyDownBtn;
|
||||
//}
|
||||
|
||||
-(QXNewPeoplePopView *)nPeopleRechargeView{
|
||||
if (!_nPeopleRechargeView) {
|
||||
_nPeopleRechargeView = [[QXNewPeoplePopView alloc] init];
|
||||
|
||||
@@ -109,7 +109,7 @@ static NSInteger maxCount = 5;
|
||||
_model = model;
|
||||
NSString *giftInfo = [NSString stringWithFormat:@"%@%@%@ %@X%@",model.fromUserName,QXText(@"送给了"),model.toUserName,model.giftName,model.number];
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:giftInfo];
|
||||
[attr yy_setColor:RGB16A(0xffffff, 0.84) range:[giftInfo rangeOfString:QXText(@"送给了")]];
|
||||
[attr yy_setColor:RGB16A(0x9FFFED, 0.84) range:[giftInfo rangeOfString:QXText(@"送给了")]];
|
||||
self.titleLabel.attributedText = attr;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
|
||||
45
QXLive/HomePage(声播)/View/首页/QXHomeTopView.h
Normal file
45
QXLive/HomePage(声播)/View/首页/QXHomeTopView.h
Normal file
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// QXHomeTopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/20.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 热门房间
|
||||
QXHomeTopClickTypeHotRoom = 0,
|
||||
/// 我的房间
|
||||
QXHomeTopClickTypeMyRoom,
|
||||
/// 排行榜
|
||||
QXHomeTopClickTypeRank,
|
||||
/// 官方公告
|
||||
QXHomeTopClickTypeNotice,
|
||||
/// 进入房间
|
||||
QXHomeTopClickTypeJoinRoom,
|
||||
}QXHomeTopClickType;
|
||||
|
||||
@protocol QXHomeTopViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
-(void)didClickTopViewType:(QXHomeTopClickType)type;
|
||||
|
||||
@end
|
||||
@interface QXHomeTopView : UIView
|
||||
@property (weak,nonatomic)id<QXHomeTopViewDelegate>delegate;
|
||||
-(void)reloadData;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXHomeTopSubView : UIView
|
||||
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *subTitleLabel;
|
||||
@property (nonatomic,strong)UIButton *btn;
|
||||
@property (nonatomic,assign)QXHomeTopClickType type;
|
||||
@property (weak,nonatomic)id<QXHomeTopViewDelegate>delegate;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
201
QXLive/HomePage(声播)/View/首页/QXHomeTopView.m
Normal file
201
QXLive/HomePage(声播)/View/首页/QXHomeTopView.m
Normal file
@@ -0,0 +1,201 @@
|
||||
//
|
||||
// QXHomeTopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/10/20.
|
||||
//
|
||||
|
||||
#import "QXHomeTopView.h"
|
||||
@interface QXHomeTopView()<QXHomeTopViewDelegate>
|
||||
@property (nonatomic,strong)UIImageView *hotRoomImageView;
|
||||
@property (nonatomic,strong)UIImageView *hotIconImageView;
|
||||
@property (nonatomic,strong)UILabel *hotLabel;
|
||||
@property (nonatomic,strong)UIButton *hotRoomBtn;
|
||||
|
||||
@property (nonatomic,strong)QXHomeTopSubView *myRoomView;
|
||||
|
||||
@property (nonatomic,strong)QXHomeTopSubView *rankView;
|
||||
|
||||
@property (nonatomic,strong)QXHomeTopSubView *noticeView;
|
||||
@end
|
||||
|
||||
@implementation QXHomeTopView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.hotRoomImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_hot_bg"]];
|
||||
self.hotRoomImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.hotRoomImageView];
|
||||
[self.hotRoomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self);
|
||||
make.left.mas_equalTo(16);
|
||||
make.width.mas_equalTo(ScaleWidth(164));
|
||||
make.height.mas_equalTo(ScaleWidth(184));
|
||||
}];
|
||||
|
||||
self.hotIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_hot_icon"]];
|
||||
[self addSubview:self.hotIconImageView];
|
||||
[self.hotIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.hotRoomImageView).offset(12);
|
||||
make.top.mas_equalTo(20);
|
||||
make.width.height.mas_equalTo(ScaleWidth(18));
|
||||
}];
|
||||
|
||||
self.hotRoomBtn = [[UIButton alloc] init];
|
||||
[self.hotRoomBtn setImage:[UIImage imageNamed:@"home_hot_room_goto"] forState:(UIControlStateNormal)];
|
||||
[self.hotRoomBtn addTarget:self action:@selector(hotRoomAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.hotRoomBtn];
|
||||
[self.hotRoomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.hotIconImageView);
|
||||
make.right.equalTo(self.hotRoomImageView);
|
||||
make.height.mas_equalTo(40);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
self.hotLabel = [[UILabel alloc] init];
|
||||
self.hotLabel.textColor = RGB16(0xF1ECFF);
|
||||
self.hotLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:20];
|
||||
self.hotLabel.text = @"热门房间";
|
||||
[self addSubview:self.hotLabel];
|
||||
[self.hotLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.hotIconImageView.mas_right);
|
||||
make.right.equalTo(self.hotRoomBtn.mas_left);
|
||||
make.centerY.equalTo(self.hotIconImageView);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.myRoomView = [[QXHomeTopSubView alloc] init];
|
||||
self.myRoomView.type = QXHomeTopClickTypeMyRoom;
|
||||
self.myRoomView.delegate = self;
|
||||
[self addSubview:self.myRoomView];
|
||||
[self.myRoomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.hotRoomImageView);
|
||||
make.left.equalTo(self.hotRoomImageView.mas_right).offset(14);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(ScaleWidth(56));
|
||||
}];
|
||||
|
||||
self.rankView = [[QXHomeTopSubView alloc] init];
|
||||
self.rankView.type = QXHomeTopClickTypeRank;
|
||||
self.rankView.delegate = self;
|
||||
[self addSubview:self.rankView];
|
||||
[self.rankView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.hotRoomImageView);
|
||||
make.left.right.equalTo(self.myRoomView);
|
||||
make.height.mas_equalTo(ScaleWidth(56));
|
||||
}];
|
||||
|
||||
self.noticeView = [[QXHomeTopSubView alloc] init];
|
||||
self.noticeView.type = QXHomeTopClickTypeNotice;
|
||||
self.noticeView.delegate = self;
|
||||
[self addSubview:self.noticeView];
|
||||
[self.noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.hotRoomImageView);
|
||||
make.left.right.equalTo(self.myRoomView);
|
||||
make.height.mas_equalTo(ScaleWidth(56));
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)reloadData{
|
||||
|
||||
}
|
||||
-(void)didClickTopViewType:(QXHomeTopClickType)type{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTopViewType:)]) {
|
||||
[self.delegate didClickTopViewType:type];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)hotRoomAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTopViewType:)]) {
|
||||
[self.delegate didClickTopViewType:QXHomeTopClickTypeHotRoom];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXHomeTopSubView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)setType:(QXHomeTopClickType)type{
|
||||
_type = type;
|
||||
switch (type) {
|
||||
case QXHomeTopClickTypeMyRoom:
|
||||
self.titleLabel.text = @"我的房间";
|
||||
self.subTitleLabel.text = @"进行一场灵魂深聊";
|
||||
self.bgImageView.image = [UIImage imageNamed:@"home_my_room_bg"];
|
||||
break;
|
||||
case QXHomeTopClickTypeRank:
|
||||
self.titleLabel.text = @"排行榜";
|
||||
self.subTitleLabel.text = @"荣耀之巅 彰显实力";
|
||||
self.bgImageView.image = [UIImage imageNamed:@"home_rank_bg"];
|
||||
break;
|
||||
case QXHomeTopClickTypeNotice:
|
||||
self.titleLabel.text = @"官方公告";
|
||||
self.subTitleLabel.text = @"政策变动一键留痕";
|
||||
self.bgImageView.image = [UIImage imageNamed:@"home_notice_bg"];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] init];
|
||||
self.bgImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = RGB16(0xF1ECFF);
|
||||
self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:18];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgImageView).offset(11);
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(8));
|
||||
}];
|
||||
|
||||
self.subTitleLabel = [[UILabel alloc] init];
|
||||
self.subTitleLabel.textColor = RGB16(0xF1ECFF);
|
||||
self.subTitleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.subTitleLabel];
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel);
|
||||
make.bottom.equalTo(self).offset(-ScaleWidth(6));
|
||||
}];
|
||||
|
||||
self.btn = [[UIButton alloc] init];
|
||||
[self.btn addTarget:self action:@selector(btnAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.btn];
|
||||
[self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)btnAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickTopViewType:)]) {
|
||||
[self.delegate didClickTopViewType:self.type];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user