119 lines
4.8 KiB
Objective-C
119 lines
4.8 KiB
Objective-C
//
|
|
// QXDynamicViewController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/4/24.
|
|
//
|
|
|
|
#import "QXDynamicViewController.h"
|
|
#import "QXPublishViewController.h"
|
|
#import "JXCategoryView.h"
|
|
#import "QXExpansionViewController.h"
|
|
#import "QXFindViewController.h"
|
|
|
|
@interface QXDynamicViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
|
@property (nonatomic,strong)UIButton *publishBtn;
|
|
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
|
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
|
@property (nonatomic,strong)QXFindViewController *findVC;
|
|
@end
|
|
|
|
@implementation QXDynamicViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
[super viewWillAppear:animated];
|
|
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
}
|
|
- (void)initSubViews{
|
|
// UILabel *tLabel = [[UILabel alloc] init];
|
|
// tLabel.text = QXText(@"广场");
|
|
// tLabel.font = [UIFont boldSystemFontOfSize:20];
|
|
// [self.view addSubview:tLabel];
|
|
// [tLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
// make.left.mas_equalTo(16);
|
|
// make.top.mas_equalTo(kSafeAreaTop +10);
|
|
// }];
|
|
self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(14, kSafeAreaTop, 100, 44)];
|
|
self.categoryView.delegate = self;
|
|
// self.categoryView.titles = @[QXText(@"发现"),QXText(@"扩列")];
|
|
self.categoryView.titles = @[QXText(@"扩列"),QXText(@"发现")];
|
|
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
|
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
|
|
self.categoryView.cellWidth = 50;
|
|
self.categoryView.contentEdgeInsetLeft = 0;
|
|
self.categoryView.cellSpacing = 0;
|
|
// self.categoryView.titleLabelZoomScale = 1.1;
|
|
self.categoryView.titleLabelZoomEnabled = YES;
|
|
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:16];
|
|
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:18];
|
|
self.categoryView.averageCellSpacingEnabled = NO;
|
|
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
|
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
|
indicatorView.indicatorImageViewSize = CGSizeMake(35, 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.containerView.scrollView.scrollEnabled = NO;
|
|
[self.view addSubview:self.categoryView];
|
|
[self.view addSubview:self.containerView];
|
|
self.categoryView.listContainer = self.containerView;
|
|
|
|
[self.view addSubview:self.publishBtn];
|
|
|
|
}
|
|
|
|
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
|
return 2;
|
|
}
|
|
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
|
// if (index == 0) {
|
|
// QXFindViewController *vc = [[QXFindViewController alloc] init];
|
|
// self.findVC = vc;
|
|
// return vc;
|
|
// }else{
|
|
// QXExpansionViewController *vc = [[QXExpansionViewController alloc] init];
|
|
// return vc;
|
|
// }
|
|
if (index == 0) {
|
|
QXExpansionViewController *vc = [[QXExpansionViewController alloc] init];
|
|
return vc;
|
|
}else{
|
|
QXFindViewController *vc = [[QXFindViewController alloc] init];
|
|
self.findVC = vc;
|
|
return vc;
|
|
}
|
|
}
|
|
-(void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{
|
|
self.publishBtn.hidden = !(index==1);
|
|
}
|
|
#pragma mark - action
|
|
-(void)pulishAction{
|
|
if (!QXGlobal.shareGlobal.isLogin) {
|
|
[[QXGlobal shareGlobal] logOut];
|
|
return;
|
|
}
|
|
QXPublishViewController *vc = [[QXPublishViewController alloc] init];
|
|
MJWeakSelf
|
|
vc.publishFinishBlock = ^{
|
|
[weakSelf.findVC.tableView.mj_header beginRefreshing];
|
|
[weakSelf.findVC getTopicList];
|
|
};
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
-(UIButton *)publishBtn{
|
|
if (!_publishBtn) {
|
|
_publishBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-44-8, kSafeAreaTop, 44, 44)];
|
|
[_publishBtn setImage:[UIImage imageNamed:@"publish_icon"] forState:UIControlStateNormal];
|
|
[_publishBtn setImage:[UIImage imageNamed:@"publish_icon"] forState:UIControlStateHighlighted];
|
|
[_publishBtn addTarget:self action:@selector(pulishAction) forControlEvents:UIControlEventTouchUpInside];
|
|
_publishBtn.hidden = YES;
|
|
}
|
|
return _publishBtn;
|
|
}
|
|
@end
|