// // QXRoomRankView.m // QXLive // // Created by 启星 on 2025/6/9. // #import "QXRoomRankView.h" #import "JXCategoryView.h" #import "QXRoomRankSubView.h" @interface QXRoomRankView() @property (nonatomic,strong)UIImageView *bgImageView; @property (nonatomic,strong)UIView *bgView; @property (nonatomic,strong)JXCategoryTitleView *categoryView; @property (nonatomic,strong)JXCategoryListContainerView *containerView; @property (nonatomic,strong)QXRoomRankSubView *moneyView; @property (nonatomic,strong)QXRoomRankSubView *charmView; @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)setRoomId:(NSString *)roomId{ _roomId = roomId; self.charmView.roomId = roomId; self.moneyView.roomId = roomId; } -(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]; }]; } -(void)previewUserInfoWithUserId:(NSString *)userId{ if (self.delegate && [self.delegate respondsToSelector:@selector(previewUserInfoWithUserId:)]) { [self.delegate previewUserInfoWithUserId:userId]; } } - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ return 2; } - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{ QXRoomRankSubView *vc = [[QXRoomRankSubView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height-ScaleWidth(144)-44)]; vc.delegate = self; if (index == 0) { vc.type = @"1"; self.moneyView = vc; }else{ vc.type = @"2"; self.charmView = vc; } vc.roomId = self.roomId; return vc; } @end