提交
This commit is contained in:
117
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.m
Normal file
117
QXLive/HomePage(声播)/View/房间/点歌/QXRoomSongListView.m
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// QXRoomSongListView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomSongListView.h"
|
||||
#import "JXCategoryView.h"
|
||||
#import "QXRoomSongListSubView.h"
|
||||
|
||||
@interface QXRoomSongListView()<UIGestureRecognizerDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
||||
@end
|
||||
@implementation QXRoomSongListView
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hide)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, ScaleWidth(144), SCREEN_WIDTH, kSafeAreaBottom+ScaleWidth(429))];
|
||||
self.bgView.backgroundColor = UIColor.whiteColor;
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.categoryView = [[JXCategoryTitleView alloc] init];
|
||||
self.categoryView.frame = CGRectMake((self.width-150)/2,0,150, 44);
|
||||
self.categoryView.delegate = self;
|
||||
self.categoryView.titles = @[QXText(@"点歌"),QXText(@"已点")];
|
||||
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#33333"];
|
||||
self.categoryView.titleColor = [UIColor colorWithHexString:@"#999999"];
|
||||
self.categoryView.cellWidth = 51;
|
||||
self.categoryView.cellSpacing = 20;
|
||||
self.categoryView.contentEdgeInsetLeft = 8;
|
||||
// self.categoryView.contentEdgeInsetRight = 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.bgView.height-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;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
||||
return 2;
|
||||
}
|
||||
-(void)setIsBgMusic:(BOOL)isBgMusic{
|
||||
_isBgMusic = isBgMusic;
|
||||
}
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
||||
QXRoomSongListSubView *vc = [[QXRoomSongListSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.bgView.height-44)];
|
||||
vc.isBgMusic = self.isBgMusic;
|
||||
vc.isCompere = self.isCompere;
|
||||
if (index == 0) {
|
||||
vc.isSearch = YES;
|
||||
}else{
|
||||
vc.isSearch = NO;
|
||||
}
|
||||
vc.roomId = self.roomId;
|
||||
vc.beiginEditBlock = ^{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = kSafeAreaTop+90;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
};
|
||||
vc.endEditBlock = ^{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-ScaleWidth(429)-kSafeAreaBottom;
|
||||
} completion:^(BOOL finished) {
|
||||
|
||||
}];
|
||||
};
|
||||
|
||||
return vc;
|
||||
}
|
||||
|
||||
-(void)showInView:(UIView *)view{
|
||||
[self.categoryView reloadData];
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT- ScaleWidth(429)-kSafeAreaBottom;
|
||||
}];
|
||||
}
|
||||
-(void)hide{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user