Commit 9578a939f17b6ee928b95630e29de7f3e6124d4f

Authored by zhangxiaowen
1 parent 0dfb42b9

no message

CNLiveBalanceModule.podspec
... ... @@ -120,6 +120,9 @@ TODO: 网家家-余额模块.
120 120 #
121 121 s.dependency 'CNLiveCustomUI'
122 122  
  123 + # 自定义控件
  124 + s.dependency 'CNLiveCustomControl'
  125 +
123 126 s.static_framework = true
124 127  
125 128 end
... ...
CNLiveBalanceModule/Classes/Controller/CNLiveBalanceController.m
... ... @@ -15,15 +15,15 @@
15 15 #import "CNLiveBaseKit.h"
16 16 #import "CNLiveServices.h"
17 17 #import "CNLiveCategory.h"
  18 +#import "CNLiveNavigationBar.h"
18 19  
19 20 #import "CNLiveBalanceRequest.h"
20   -#import "CNLiveBalanceNavigationBar.h"
21 21 #import "CNLiveBalanceView.h"
22 22 #import "CNLivePayCenterController.h"
23 23 #import "CNLiveBalanceDetailController.h"
24 24  
25   -@interface CNLiveBalanceController ()<CNLiveBalanceNavigationBarDelegate>
26   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  25 +@interface CNLiveBalanceController ()
  26 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
27 27 @property (nonatomic, strong) CNLiveBalanceView *balanceView;
28 28  
29 29 @property (nonatomic, copy) NSString *type;
... ... @@ -80,26 +80,6 @@
80 80  
81 81 }
82 82  
83   -#pragma mark - CNLiveBalanceNavigationBarDelegate
84   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
85   - if ([actionEvents isEqualToString:@"1"]) {
86   - [self goBack];
87   -
88   - }else if ([actionEvents isEqualToString:@"2"]){
89   -
90   - if ([self.type isEqualToString:@"1"]) { // 支付中心
91   - CNLivePayCenterController *vc = [CNLivePayCenterController new];
92   - [self.navigationController pushViewController:vc animated:YES];
93   -
94   - } else if ([self.type isEqualToString:@"2"]) { // 明细
95   - CNLiveBalanceDetailController *vc = [CNLiveBalanceDetailController new];
96   - vc.ID = self.ID;
97   - [self.navigationController pushViewController:vc animated:YES];
98   - }
99   -
100   - }
101   -}
102   -
103 83 #pragma mark - 响应方法
104 84 - (void)goBack {
105 85 if (self.presentingViewController != nil) {
... ... @@ -111,21 +91,50 @@
111 91 }
112 92  
113 93 #pragma mark - 懒加载
114   -- (CNLiveBalanceNavigationBar *)navigationBar {
  94 +- (CNLiveNavigationBar *)navigationBar {
115 95 if (!_navigationBar) {
116   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
117   - _navigationBar.delegate = self;
  96 + _navigationBar = [CNLiveNavigationBar navigationBar];
  97 + _navigationBar.backgroundColor = [UIColor clearColor];
  98 + _navigationBar.title.textColor = [UIColor whiteColor];
  99 +
  100 + UIImage *image = [self getImageWithImageName:@"cnlive_back_white_b" bundleName:@"CNLiveCustomControl" targetClass:[CNLiveNavigationBar class]];
  101 + _navigationBar.leftImage = image;
  102 +
118 103 if([self.type isEqualToString:@"1"]){
119 104 // 个人余额
120 105 _navigationBar.title.text = @"中国网家家补贴余额";
121 106 UIImage *image = [self getImageWithImageName:@"balance_pay_center" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
122   - [_navigationBar.right setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
  107 + _navigationBar.rightImage = image;
123 108  
124 109 }else if ([self.type isEqualToString:@"2"]){
125 110 // 特色群组
126 111 _navigationBar.title.text = @"余额";
127   - [_navigationBar.right setTitle:@"明细" forState:UIControlStateNormal];
  112 + _navigationBar.rightTitle = @"明细";
  113 + [_navigationBar.right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
128 114 }
  115 +
  116 + _navigationBar.lineHidden = YES;
  117 +
  118 + __weak typeof(self) weakSelf = self;
  119 + _navigationBar.onClickLeftButton = ^{
  120 + __strong typeof(weakSelf) strongSelf = weakSelf;
  121 + if(!strongSelf) return ;
  122 + [strongSelf goBack];
  123 + };
  124 + _navigationBar.onClickRightButton = ^{
  125 + __strong typeof(weakSelf) strongSelf = weakSelf;
  126 + if(!strongSelf) return ;
  127 + if ([strongSelf.type isEqualToString:@"1"]) { // 支付中心
  128 + CNLivePayCenterController *vc = [CNLivePayCenterController new];
  129 + [strongSelf.navigationController pushViewController:vc animated:YES];
  130 +
  131 + } else if ([strongSelf.type isEqualToString:@"2"]) { // 明细
  132 + CNLiveBalanceDetailController *vc = [CNLiveBalanceDetailController new];
  133 + vc.ID = strongSelf.ID;
  134 + [strongSelf.navigationController pushViewController:vc animated:YES];
  135 + }
  136 +
  137 + };
129 138 }
130 139 return _navigationBar;
131 140 }
... ...
CNLiveBalanceModule/Classes/Detail/CNLiveBalanceDetailController.m
... ... @@ -12,12 +12,12 @@
12 12 #import "CNLiveBaseKit.h"
13 13 #import "CNLiveCategory.h"
14 14 #import "JXCategoryView.h"
  15 +#import "CNLiveNavigationBar.h"
15 16  
16   -#import "CNLiveBalanceNavigationBar.h"
17 17 #import "CNLiveBalanceDetailBaseController.h"
18 18  
19   -@interface CNLiveBalanceDetailController ()<CNLiveBalanceNavigationBarDelegate,JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
20   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  19 +@interface CNLiveBalanceDetailController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  20 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
21 21 @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
22 22 @property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
23 23 @property (nonatomic, strong) NSArray *titles;
... ... @@ -58,21 +58,6 @@ static const CGFloat height = 44;
58 58  
59 59 }
60 60  
61   -#pragma mark - 懒加载
62   -- (CNLiveBalanceNavigationBar *)navigationBar {
63   - if (!_navigationBar) {
64   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
65   - _navigationBar.backgroundColor = [UIColor whiteColor];
66   - _navigationBar.delegate = self;
67   - _navigationBar.title.text = @"明细";
68   - _navigationBar.title.textColor = [UIColor blackColor];
69   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
70   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
71   - _navigationBar.right = nil;
72   - }
73   - return _navigationBar;
74   -}
75   -
76 61 #pragma mark - JXCategoryViewDelegate
77 62 - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
78 63 //侧滑手势处理
... ... @@ -90,14 +75,6 @@ static const CGFloat height = 44;
90 75 return self.titles.count;
91 76 }
92 77  
93   -#pragma mark - CNLiveBalanceNavigationBarDelegate
94   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
95   - if ([actionEvents isEqualToString:@"1"]) {
96   - [self goBack];
97   -
98   - }
99   -}
100   -
101 78 #pragma mark - 响应方法
102 79 - (void)goBack {
103 80 if (self.presentingViewController != nil) {
... ... @@ -109,6 +86,20 @@ static const CGFloat height = 44;
109 86 }
110 87  
111 88 #pragma mark - 懒加载
  89 +- (CNLiveNavigationBar *)navigationBar {
  90 + if (!_navigationBar) {
  91 + _navigationBar = [CNLiveNavigationBar navigationBar];
  92 + _navigationBar.title.text = @"明细";
  93 + __weak typeof(self) weakSelf = self;
  94 + _navigationBar.onClickLeftButton = ^{
  95 + __strong typeof(weakSelf) strongSelf = weakSelf;
  96 + if(!strongSelf) return ;
  97 + [strongSelf goBack];
  98 + };
  99 + }
  100 + return _navigationBar;
  101 +}
  102 +
112 103 - (UIView *)tline {
113 104 if (!_tline) {
114 105 _tline = [[UIView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, self.view.bounds.size.width, 0.5)];
... ...
CNLiveBalanceModule/Classes/PayCenter/CNLivePayCenterController.m
... ... @@ -12,15 +12,15 @@
12 12  
13 13 #import "CNLiveCategory.h"
14 14 #import "CNUserInfoManager.h"
  15 +#import "CNLiveNavigationBar.h"
15 16  
16   -#import "CNLiveBalanceNavigationBar.h"
17 17 #import "CNLiveBalanceModel.h"
18 18 #import "CNLivePayCenterCell.h"
19 19 #import "CNLiveTradingRecordController.h" // 交易记录
20 20 #import "CNLivePayManagerController.h"// 支付管理
21 21  
22   -@interface CNLivePayCenterController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate>
23   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  22 +@interface CNLivePayCenterController ()<UITableViewDelegate, UITableViewDataSource>
  23 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
24 24 @property (nonatomic, strong) UITableView *tableView;
25 25  
26 26 @property (nonatomic, strong) NSMutableArray *data;
... ... @@ -115,17 +115,16 @@
115 115 }
116 116 return _data;
117 117 }
118   -- (CNLiveBalanceNavigationBar *)navigationBar {
  118 +- (CNLiveNavigationBar *)navigationBar {
119 119 if (!_navigationBar) {
120   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
121   - _navigationBar.backgroundColor = [UIColor whiteColor];
122   - _navigationBar.delegate = self;
  120 + _navigationBar = [CNLiveNavigationBar navigationBar];
123 121 _navigationBar.title.text = @"支付中心";
124   - _navigationBar.title.textColor = [UIColor blackColor];
125   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
126   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
127   - _navigationBar.right = nil;
128   -
  122 + __weak typeof(self) weakSelf = self;
  123 + _navigationBar.onClickLeftButton = ^{
  124 + __strong typeof(weakSelf) strongSelf = weakSelf;
  125 + if(!strongSelf) return ;
  126 + [strongSelf goBack];
  127 + };
129 128 }
130 129 return _navigationBar;
131 130 }
... ... @@ -154,13 +153,4 @@
154 153 }
155 154 }
156 155  
157   -#pragma mark - CNLiveBalanceNavigationBarDelegate
158   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
159   - if ([actionEvents isEqualToString:@"1"]) {
160   - [self goBack];
161   - }else if ([actionEvents isEqualToString:@"2"]){
162   -
163   - }
164   -}
165   -
166 156 @end
... ...
CNLiveBalanceModule/Classes/PayManager/CNLiveChangePayPasswordController.m
... ... @@ -15,12 +15,12 @@
15 15 #import "CNLiveBaseKit.h"
16 16 #import "CNLiveServices.h"
17 17 #import "CNLiveCategory.h"
  18 +#import "CNLiveNavigationBar.h"
18 19  
19 20 #import "CNLiveBalanceRequest.h"
20   -#import "CNLiveBalanceNavigationBar.h"
21 21  
22   -@interface CNLiveChangePayPasswordController ()<CNLiveBalanceNavigationBarDelegate>
23   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  22 +@interface CNLiveChangePayPasswordController ()
  23 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
24 24 @property (nonatomic, strong) CNLiveChangePayPasswordView *changePayPasswordView;
25 25  
26 26 @property (nonatomic, assign) CNLiveChangePayPasswordType type;
... ... @@ -60,16 +60,16 @@
60 60 }
61 61  
62 62 #pragma mark - 懒加载
63   -- (CNLiveBalanceNavigationBar *)navigationBar {
  63 +- (CNLiveNavigationBar *)navigationBar {
64 64 if (!_navigationBar) {
65   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
66   - _navigationBar.delegate = self;
67   - _navigationBar.backgroundColor = [UIColor whiteColor];
  65 + _navigationBar = [CNLiveNavigationBar navigationBar];
68 66 _navigationBar.title.text = @"修改支付密码";
69   - _navigationBar.title.textColor = [UIColor blackColor];
70   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
71   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
72   - _navigationBar.right = nil;
  67 + __weak typeof(self) weakSelf = self;
  68 + _navigationBar.onClickLeftButton = ^{
  69 + __strong typeof(weakSelf) strongSelf = weakSelf;
  70 + if(!strongSelf) return ;
  71 + [strongSelf goBack];
  72 + };
73 73 }
74 74 return _navigationBar;
75 75 }
... ... @@ -91,11 +91,4 @@
91 91 }
92 92 }
93 93  
94   -#pragma mark - CNLiveBalanceNavigationBarDelegate
95   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
96   - if ([actionEvents isEqualToString:@"1"]) {
97   - [self goBack];
98   - }
99   -}
100   -
101 94 @end
... ...
CNLiveBalanceModule/Classes/PayManager/CNLivePayManagerController.m
... ... @@ -11,14 +11,14 @@
11 11 #import "QMUIKit.h"
12 12  
13 13 #import "CNLiveCategory.h"
  14 +#import "CNLiveNavigationBar.h"
14 15  
15   -#import "CNLiveBalanceNavigationBar.h"
16 16 #import "CNLiveBalanceModel.h"
17 17 #import "CNLivePayCenterCell.h"
18 18 #import "CNLiveChangePayPasswordController.h"
19 19  
20   -@interface CNLivePayManagerController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate>
21   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  20 +@interface CNLivePayManagerController ()<UITableViewDelegate, UITableViewDataSource>
  21 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
22 22 @property (nonatomic, strong) UITableView *tableView;
23 23  
24 24 @property (nonatomic, strong) NSMutableArray *data;
... ... @@ -103,17 +103,17 @@
103 103 }
104 104 return _data;
105 105 }
106   -- (CNLiveBalanceNavigationBar *)navigationBar {
  106 +
  107 +- (CNLiveNavigationBar *)navigationBar {
107 108 if (!_navigationBar) {
108   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
109   - _navigationBar.backgroundColor = [UIColor whiteColor];
110   - _navigationBar.delegate = self;
  109 + _navigationBar = [CNLiveNavigationBar navigationBar];
111 110 _navigationBar.title.text = @"支付管理";
112   - _navigationBar.title.textColor = [UIColor blackColor];
113   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
114   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
115   - _navigationBar.right = nil;
116   -
  111 + __weak typeof(self) weakSelf = self;
  112 + _navigationBar.onClickLeftButton = ^{
  113 + __strong typeof(weakSelf) strongSelf = weakSelf;
  114 + if(!strongSelf) return ;
  115 + [strongSelf goBack];
  116 + };
117 117 }
118 118 return _navigationBar;
119 119 }
... ... @@ -141,13 +141,4 @@
141 141 }
142 142 }
143 143  
144   -#pragma mark - CNLiveBalanceNavigationBarDelegate
145   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
146   - if ([actionEvents isEqualToString:@"1"]) {
147   - [self goBack];
148   - }else if ([actionEvents isEqualToString:@"2"]){
149   -
150   - }
151   -}
152   -
153 144 @end
... ...
CNLiveBalanceModule/Classes/TradingRecord/CNLiveMonthBillController.m
... ... @@ -18,18 +18,17 @@
18 18 #import "CNLiveBaseKit.h"
19 19 #import "CNLiveCategory.h"
20 20 #import "CNLiveRefreshHeader.h"
21   -
22 21 #import "CNLiveServices.h"
23   -#import "CNLiveBalanceRequest.h"
  22 +#import "CNLiveNavigationBar.h"
24 23  
25   -#import "CNLiveBalanceNavigationBar.h"
  24 +#import "CNLiveBalanceRequest.h"
26 25 #import "CNLiveMonthBillView.h"
27 26 #import "CNLiveTradingRecordModel.h"
28 27 #import "CNLiveTradingRecordCell.h"
29 28 #import "CNLiveTradingRecordDetailController.h"
30 29  
31   -@interface CNLiveMonthBillController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate,CNLiveMonthBillViewDelegate>
32   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  30 +@interface CNLiveMonthBillController ()<UITableViewDelegate, UITableViewDataSource,CNLiveMonthBillViewDelegate>
  31 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
33 32 @property (nonatomic, strong) CNLiveMonthBillView *monthBillView;
34 33 @property (nonatomic, strong) UITableView *tableView;
35 34 @property (nonatomic, strong) NSMutableArray *data;
... ... @@ -176,17 +175,16 @@ static const CGFloat height = 60;
176 175 }
177 176 return _data;
178 177 }
179   -- (CNLiveBalanceNavigationBar *)navigationBar {
  178 +- (CNLiveNavigationBar *)navigationBar {
180 179 if (!_navigationBar) {
181   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
182   - _navigationBar.backgroundColor = [UIColor whiteColor];
183   - _navigationBar.delegate = self;
  180 + _navigationBar = [CNLiveNavigationBar navigationBar];
184 181 _navigationBar.title.text = @"月账单";
185   - _navigationBar.title.textColor = [UIColor blackColor];
186   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
187   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
188   - _navigationBar.right = nil;
189   -
  182 + __weak typeof(self) weakSelf = self;
  183 + _navigationBar.onClickLeftButton = ^{
  184 + __strong typeof(weakSelf) strongSelf = weakSelf;
  185 + if(!strongSelf) return ;
  186 + [strongSelf goBack];
  187 + };
190 188 }
191 189 return _navigationBar;
192 190 }
... ... @@ -224,13 +222,4 @@ static const CGFloat height = 60;
224 222 }
225 223 }
226 224  
227   -#pragma mark - CNLiveBalanceNavigationBarDelegate
228   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
229   - if ([actionEvents isEqualToString:@"1"]) {
230   - [self goBack];
231   - }else if ([actionEvents isEqualToString:@"2"]){
232   -
233   - }
234   -}
235   -
236 225 @end
... ...
CNLiveBalanceModule/Classes/TradingRecord/CNLiveTradingRecordController.m
... ... @@ -19,17 +19,19 @@
19 19 #import "CNLiveRefreshHeader.h"
20 20  
21 21 #import "CNLiveServices.h"
  22 +#import "CNLiveNavigationBar.h"
  23 +
  24 +
22 25 #import "CNLiveBalanceRequest.h"
23 26  
24   -#import "CNLiveBalanceNavigationBar.h"
25 27 #import "CNLiveTradingRecordView.h"
26 28 #import "CNLiveMonthBillController.h" //月账单
27 29 #import "CNLiveTradingRecordModel.h"
28 30 #import "CNLiveTradingRecordCell.h"
29 31 #import "CNLiveTradingRecordDetailController.h"
30 32  
31   -@interface CNLiveTradingRecordController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate,CNLiveTradingRecordViewDelegate>
32   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  33 +@interface CNLiveTradingRecordController ()<UITableViewDelegate, UITableViewDataSource,CNLiveTradingRecordViewDelegate>
  34 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
33 35 @property (nonatomic, strong) CNLiveTradingRecordView *tradingRecordView;
34 36 @property (nonatomic, strong) UITableView *tableView;
35 37  
... ... @@ -197,17 +199,16 @@ static const CGFloat height = 80;
197 199 }
198 200 return _data;
199 201 }
200   -- (CNLiveBalanceNavigationBar *)navigationBar {
  202 +- (CNLiveNavigationBar *)navigationBar {
201 203 if (!_navigationBar) {
202   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
203   - _navigationBar.backgroundColor = [UIColor whiteColor];
204   - _navigationBar.delegate = self;
  204 + _navigationBar = [CNLiveNavigationBar navigationBar];
205 205 _navigationBar.title.text = @"交易记录";
206   - _navigationBar.title.textColor = [UIColor blackColor];
207   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
208   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
209   - _navigationBar.right = nil;
210   -
  206 + __weak typeof(self) weakSelf = self;
  207 + _navigationBar.onClickLeftButton = ^{
  208 + __strong typeof(weakSelf) strongSelf = weakSelf;
  209 + if(!strongSelf) return ;
  210 + [strongSelf goBack];
  211 + };
211 212 }
212 213 return _navigationBar;
213 214 }
... ... @@ -247,13 +248,4 @@ static const CGFloat height = 80;
247 248 }
248 249 }
249 250  
250   -#pragma mark - CNLiveBalanceNavigationBarDelegate
251   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
252   - if ([actionEvents isEqualToString:@"1"]) {
253   - [self goBack];
254   - }else if ([actionEvents isEqualToString:@"2"]){
255   -
256   - }
257   -}
258   -
259 251 @end
... ...
CNLiveBalanceModule/Classes/TradingRecord/CNLiveTradingRecordDetailController.m
... ... @@ -18,9 +18,9 @@
18 18 #import "CNLiveCategory.h"
19 19  
20 20 #import "CNLiveServices.h"
21   -#import "CNLiveBalanceRequest.h"
  21 +#import "CNLiveNavigationBar.h"
22 22  
23   -#import "CNLiveBalanceNavigationBar.h"
  23 +#import "CNLiveBalanceRequest.h"
24 24 #import "CNLiveTradingRecordView.h"
25 25 #import "CNLiveTradingRecordModel.h"
26 26 #import "CNLiveTradingRecordDetailModel.h"
... ... @@ -28,8 +28,8 @@
28 28 #import "CNLiveTradingRecordDetailHeaderView.h"
29 29 #import "CNLiveTradingRecordController.h"
30 30  
31   -@interface CNLiveTradingRecordDetailController ()<UITableViewDelegate, UITableViewDataSource,CNLiveBalanceNavigationBarDelegate>
32   -@property (nonatomic, strong) CNLiveBalanceNavigationBar *navigationBar;
  31 +@interface CNLiveTradingRecordDetailController ()<UITableViewDelegate, UITableViewDataSource>
  32 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
33 33 @property (nonatomic, strong) UITableView *tableView;
34 34 @property (nonatomic, strong) CNLiveTradingRecordDetailHeaderView *headerView;
35 35 @property (nonatomic, strong) NSMutableArray *data;
... ... @@ -153,20 +153,20 @@ static const CGFloat height = 80;
153 153 return _data;
154 154 }
155 155  
156   -- (CNLiveBalanceNavigationBar *)navigationBar {
  156 +- (CNLiveNavigationBar *)navigationBar {
157 157 if (!_navigationBar) {
158   - _navigationBar = [[CNLiveBalanceNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
159   - _navigationBar.backgroundColor = [UIColor whiteColor];
160   - _navigationBar.delegate = self;
  158 + _navigationBar = [CNLiveNavigationBar navigationBar];
161 159 _navigationBar.title.text = @"交易记录";
162   - _navigationBar.title.textColor = [UIColor blackColor];
163   - UIImage *image = [self getImageWithImageName:@"mine_back_black_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
164   - [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
165   - _navigationBar.right = nil;
166   -
  160 + __weak typeof(self) weakSelf = self;
  161 + _navigationBar.onClickLeftButton = ^{
  162 + __strong typeof(weakSelf) strongSelf = weakSelf;
  163 + if(!strongSelf) return ;
  164 + [strongSelf goBack];
  165 + };
167 166 }
168 167 return _navigationBar;
169 168 }
  169 +
170 170 - (UITableView *)tableView{
171 171 if(!_tableView){
172 172 _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain];
... ... @@ -198,13 +198,4 @@ static const CGFloat height = 80;
198 198 }
199 199 }
200 200  
201   -#pragma mark - CNLiveBalanceNavigationBarDelegate
202   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
203   - if ([actionEvents isEqualToString:@"1"]) {
204   - [self goBack];
205   - }else if ([actionEvents isEqualToString:@"2"]){
206   -
207   - }
208   -}
209   -
210 201 @end
... ...
CNLiveBalanceModule/Classes/View/CNLiveBalanceNavigationBar.h deleted 100644 → 0
1   -//
2   -// CNLiveBalanceNavigationBar.m
3   -// CNLiveBalanceModule
4   -//
5   -// Created by 153993236@qq.com on 11/12/2019.
6   -// Copyright (c) 2019 153993236@qq.com. All rights reserved.
7   -//
8   -
9   -#import <UIKit/UIKit.h>
10   -
11   -NS_ASSUME_NONNULL_BEGIN
12   -@class CNLiveBalanceNavigationBar;
13   -
14   -@protocol CNLiveBalanceNavigationBarDelegate <NSObject>
15   -- (void)navigationBar:(CNLiveBalanceNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents;
16   -
17   -@end
18   -
19   -@interface CNLiveBalanceNavigationBar : UIView
20   -@property (nonatomic, weak) id<CNLiveBalanceNavigationBarDelegate> delegate;
21   -@property (nonatomic, strong) UIView *navView;
22   -@property (nonatomic, strong) UIButton *left;
23   -@property (nonatomic, strong) UILabel *title;
24   -@property (nonatomic, strong, nullable) UIButton *right;
25   -
26   -
27   -@end
28   -
29   -NS_ASSUME_NONNULL_END
CNLiveBalanceModule/Classes/View/CNLiveBalanceNavigationBar.m deleted 100644 → 0
1   -//
2   -// CNLiveBalanceNavigationBar.m
3   -// CNLiveBalanceModule
4   -//
5   -// Created by 153993236@qq.com on 11/12/2019.
6   -// Copyright © 2019 153993236@qq.com. All rights reserved.
7   -//
8   -
9   -#import "CNLiveBalanceNavigationBar.h"
10   -#import "QMUIKit.h"
11   -#import "CNLiveCategory.h"
12   -
13   -@interface CNLiveBalanceNavigationBar ()
14   -
15   -@end
16   -
17   -@implementation CNLiveBalanceNavigationBar
18   -static const NSInteger margin = 15;
19   -
20   -- (instancetype)initWithFrame:(CGRect)frame{
21   - self = [super initWithFrame:frame];
22   - if(self){
23   - self.userInteractionEnabled = YES;
24   - self.backgroundColor = [UIColor clearColor];
25   - [self createSubViews];
26   - }
27   - return self;
28   -}
29   -
30   -- (void)dealloc {
31   - NSLog(@"CNLiveBalanceNavigationBar -- dealloc");
32   -}
33   -
34   -- (void)createSubViews {
35   - [self addSubview:self.navView];
36   - [self addSubview:self.left];
37   - [self addSubview:self.title];
38   - [self addSubview:self.right];
39   -}
40   -
41   -/*
42   - // Only override drawRect: if you perform custom drawing.
43   - // An empty implementation adversely affects performance during animation.
44   - - (void)drawRect:(CGRect)rect {
45   - // Drawing code
46   - }
47   - */
48   -
49   -#pragma mark - 懒加载
50   -- (UIView *)navView {
51   - if (!_navView) {
52   - _navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, NavigationContentTop)];
53   - _navView.backgroundColor = [UIColor clearColor];
54   - }
55   - return _navView;
56   -}
57   -
58   -- (UIButton *)left {
59   - if (!_left) {
60   - _left= [UIButton buttonWithType:UIButtonTypeCustom];
61   - _left.adjustsImageWhenHighlighted = NO;
62   - _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight);
63   - UIImage *image = [self getImageWithImageName:@"mine_back_white_b" bundleName:@"CNLiveBalanceModule" targetClass:[self class]];
64   - [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
65   - _left.titleLabel.font = [UIFont systemFontOfSize:15];
66   - [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
67   - [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
68   - }
69   - return _left;
70   -}
71   -
72   -- (UILabel *)title {
73   - if (!_title) {
74   - _title = [[UILabel alloc] initWithFrame:CGRectMake(margin+NavigationBarHeight, StatusBarHeight, SCREEN_WIDTH-2*(margin+NavigationBarHeight), NavigationBarHeight)];
75   - [_title setFont:[UIFont systemFontOfSize:18]];
76   - _title.textColor = [UIColor whiteColor];
77   - _title.textAlignment = NSTextAlignmentCenter;
78   - }
79   - return _title;
80   -}
81   -
82   -- (UIButton *)right {
83   - if (!_right) {
84   - _right = [UIButton buttonWithType:UIButtonTypeCustom];
85   - _right.frame = CGRectMake(SCREEN_WIDTH-NavigationBarHeight-margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight);
86   - [_right setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
87   - _right.adjustsImageWhenHighlighted = NO;
88   - _right.titleLabel.font = [UIFont systemFontOfSize:15];
89   - [_right setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
90   - [_right addTarget:self action:@selector(rightDidClicked:) forControlEvents:UIControlEventTouchUpInside];
91   - }
92   - return _right;
93   -}
94   -
95   -#pragma mark - 响应方法
96   -- (void)goBack{
97   - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) {
98   - [self.delegate navigationBar:self actionEvents:@"1"];
99   - }
100   -}
101   -
102   -- (void)rightDidClicked:(UIButton *)btn{
103   - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) {
104   - [self.delegate navigationBar:self actionEvents:@"2"];
105   - }
106   -}
107   -
108   -@end
Example/CNLiveBalanceModule.xcodeproj/project.pbxproj
... ... @@ -333,6 +333,7 @@
333 333 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework",
334 334 "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework",
335 335 "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework",
  336 + "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework",
336 337 "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework",
337 338 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
338 339 "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework",
... ... @@ -356,6 +357,7 @@
356 357 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework",
357 358 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework",
358 359 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework",
  360 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework",
359 361 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework",
360 362 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
361 363 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework",
... ...