117 lines
4.7 KiB
Objective-C
117 lines
4.7 KiB
Objective-C
//
|
|
// QXMyRoomViewController.m
|
|
// IsLandVoice
|
|
//
|
|
// Created by 启星 on 2025/3/5.
|
|
//
|
|
|
|
#import "QXMyRoomViewController.h"
|
|
#import "JXCategoryView.h"
|
|
#import "QXMyRoomSubViewController.h"
|
|
#import "QXCreateRoomViewController.h"
|
|
|
|
@interface QXMyRoomViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
|
|
|
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
|
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
|
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
|
@property (nonatomic,strong)NSArray *titles;
|
|
@property (nonatomic,strong)QXMyRoomSubViewController *myRoomVC;
|
|
@end
|
|
|
|
@implementation QXMyRoomViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
|
|
}
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
[super viewWillAppear:animated];
|
|
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
}
|
|
-(void)viewDidAppear:(BOOL)animated{
|
|
[super viewDidAppear:animated];
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
|
|
}
|
|
-(void)setNavgationItems{
|
|
[super setNavgationItems];
|
|
self.navigationItem.title = @"我的房间";
|
|
UIButton*createBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
|
[createBtn setImage:[UIImage imageNamed:@"mine_add"] forState:(UIControlStateNormal)];
|
|
createBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing;
|
|
[createBtn addTarget:self action:@selector(createAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:createBtn];
|
|
}
|
|
|
|
-(void)createAction{
|
|
MJWeakSelf
|
|
QXCreateRoomViewController *vc = [[QXCreateRoomViewController alloc] init];
|
|
vc.createSucceessBlock = ^{
|
|
[weakSelf.myRoomVC refreshRoom];
|
|
};
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
|
|
-(void)initSubViews{
|
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
self.titles = @[@"我创建的",@"我主持的",@"我管理的",@"我关注的"];
|
|
self.listVCArray = [NSMutableArray array];
|
|
self.categoryView = [[JXCategoryTitleView alloc] init];
|
|
self.categoryView.frame = CGRectMake(15, kSafeAreaTop+44, SCREEN_WIDTH-30, 44);
|
|
self.categoryView.delegate = self;
|
|
self.categoryView.titles = self.titles;
|
|
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
|
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
|
|
self.categoryView.cellWidth = 70;
|
|
self.categoryView.contentEdgeInsetLeft = 0;
|
|
self.categoryView.cellSpacing = 0;
|
|
// self.categoryView.titleLabelZoomScale = 1.1;
|
|
self.categoryView.titleLabelZoomEnabled = YES;
|
|
self.categoryView.titleFont = [UIFont systemFontOfSize:12];
|
|
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
|
self.categoryView.averageCellSpacingEnabled = NO;
|
|
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
|
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
|
indicatorView.indicatorImageViewSize = CGSizeMake(58, 8);
|
|
indicatorView.verticalMargin = 11;
|
|
self.categoryView.indicators = @[indicatorView];
|
|
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
|
|
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
|
|
[self.view addSubview:self.categoryView];
|
|
[self.view addSubview:self.containerView];
|
|
self.categoryView.listContainer = self.containerView;
|
|
[self requestMineUserInfoData];
|
|
}
|
|
- (void)requestMineUserInfoData {
|
|
|
|
}
|
|
|
|
|
|
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
|
return self.titles.count;
|
|
}
|
|
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
|
QXMyRoomSubViewController *vc = [[QXMyRoomSubViewController alloc] init];
|
|
vc.type = index;
|
|
if (index == 0) {
|
|
self.myRoomVC = vc;
|
|
}
|
|
return vc;
|
|
}
|
|
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
|
}
|
|
/*
|
|
#pragma mark - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
// Get the new view controller using [segue destinationViewController].
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
@end
|