CNLiveBalanceDetailController.m
5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//
// CNLiveBalanceDetailController.m
// CNLiveBalanceModule
//
// Created by 153993236@qq.com on 11/12/2019.
// Copyright (c) 2019 153993236@qq.com. All rights reserved.
//
#import "CNLiveBalanceDetailController.h"
#import "QMUIKit.h"
#import "CNLiveBaseKit.h"
#import "CNLiveCategory.h"
#import "JXCategoryView.h"
#import "CNLiveNavigationBar.h"
#import "CNLiveBalanceDetailBaseController.h"
@interface CNLiveBalanceDetailController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
@property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) UIView *tline;
@property (nonatomic, strong) UIView *bline;
@end
@implementation CNLiveBalanceDetailController
static const CGFloat height = 44;
#pragma mark - 生命周期
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
if (@available(iOS 11, *)) {
}
else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
[self createSubViews];
}
- (void)createSubViews {
[self.view addSubview:self.navigationBar];
[self.view addSubview:self.tline];
[self.view addSubview:self.titleCategoryView];
[self.view addSubview:self.bline];
[self.view addSubview:self.listContainerView];
_titleCategoryView.listContainer = self.listContainerView;
}
#pragma mark - JXCategoryViewDelegate
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
//侧滑手势处理
}
#pragma mark - JXCategoryListContainerViewDelegate
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
CNLiveBalanceDetailBaseController *list = [[CNLiveBalanceDetailBaseController alloc] init];
list.type = index;
list.ID = self.ID;
return list;
}
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
return self.titles.count;
}
#pragma mark - 响应方法
- (void)goBack {
if (self.presentingViewController != nil) {
[self dismissViewControllerAnimated:YES completion:nil];
}
else {
[self.navigationController popViewControllerAnimated:YES];
}
}
#pragma mark - 懒加载
- (CNLiveNavigationBar *)navigationBar {
if (!_navigationBar) {
_navigationBar = [CNLiveNavigationBar navigationBar];
_navigationBar.title.text = @"明细";
__weak typeof(self) weakSelf = self;
_navigationBar.onClickLeftButton = ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if(!strongSelf) return ;
[strongSelf goBack];
};
}
return _navigationBar;
}
- (UIView *)tline {
if (!_tline) {
_tline = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, self.view.bounds.size.width, 0.5)];
_tline.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
}
return _tline;
}
- (JXCategoryTitleView *)titleCategoryView{
if (!_titleCategoryView) {
_titleCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(0, _tline.bottom, self.view.bounds.size.width, height)];
_titleCategoryView.titles = self.titles;
_titleCategoryView.delegate = self;
_titleCategoryView.titleColor = [UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1.0];
_titleCategoryView.titleSelectedColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
_titleCategoryView.titleFont = [UIFont systemFontOfSize:16];
_titleCategoryView.titleLabelZoomScale = 1.0;
_titleCategoryView.collectionView.scrollEnabled = NO;
_titleCategoryView.titleLabelZoomEnabled = YES;
_titleCategoryView.titleColorGradientEnabled = YES;
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
lineView.indicatorColor = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
lineView.indicatorWidth = 40;
_titleCategoryView.indicators = @[lineView];
}
return _titleCategoryView;
}
- (UIView *)bline {
if (!_bline) {
_bline = [[UIView alloc] initWithFrame:CGRectMake(0, _titleCategoryView.bottom, self.view.bounds.size.width, 0.5)];
_bline.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0];
}
return _bline;
}
- (JXCategoryListContainerView *)listContainerView {
if (_listContainerView == nil) {
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_listContainerView.frame = CGRectMake(0, _bline.bottom, self.view.bounds.size.width, self.view.bounds.size.height-_bline.bottom);
}
return _listContainerView;
}
- (NSArray *)titles{
if (!_titles) {
_titles = [NSArray arrayWithObjects:@"全部", @"收入", @"支出", nil];
}
return _titles;
}
@end