Commit 4f288770553f30030232233796e011f8f698bc31

Authored by zhangxiaowen
1 parent a28dcb4c

no message

CNLiveCollectionModule.podspec
@@ -93,6 +93,9 @@ TODO: 网家家-我的模块. @@ -93,6 +93,9 @@ TODO: 网家家-我的模块.
93 # 93 #
94 s.dependency 'CNLiveCustomUI' 94 s.dependency 'CNLiveCustomUI'
95 95
  96 + # 自定义控件
  97 + s.dependency 'CNLiveCustomControl'
  98 +
96 s.dependency 'CNLiveCommonCategory' 99 s.dependency 'CNLiveCommonCategory'
97 s.dependency 'CNLiveBaseKit' 100 s.dependency 'CNLiveBaseKit'
98 101
CNLiveCollectionModule/Classes/Controller/CNLiveCollectionController.m
@@ -15,14 +15,14 @@ @@ -15,14 +15,14 @@
15 #import "CNLiveRefreshHeader.h" 15 #import "CNLiveRefreshHeader.h"
16 #import "CNLiveRefreshFooter.h" 16 #import "CNLiveRefreshFooter.h"
17 17
18 -#import "CNLiveCollectionNavigationBar.h" 18 +#import "CNLiveNavigationBar.h"
19 #import "CNLiveCollectionCell.h" 19 #import "CNLiveCollectionCell.h"
20 #import "CNLiveCollectionModel.h" 20 #import "CNLiveCollectionModel.h"
21 21
22 #import "CNLiveCollectionRequest.h" 22 #import "CNLiveCollectionRequest.h"
23 23
24 -@interface CNLiveCollectionController ()<UITableViewDelegate, UITableViewDataSource,CNLiveCollectionNavigationBarDelegate,CNLiveCollectionCellDelegate>  
25 -@property (nonatomic, strong) CNLiveCollectionNavigationBar *navigationBar; 24 +@interface CNLiveCollectionController ()<UITableViewDelegate, UITableViewDataSource, CNLiveCollectionCellDelegate>
  25 +@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
26 @property (nonatomic, strong) UITableView *tableView; 26 @property (nonatomic, strong) UITableView *tableView;
27 @property (nonatomic, strong) NSMutableArray *data; 27 @property (nonatomic, strong) NSMutableArray *data;
28 28
@@ -188,13 +188,6 @@ static const CGFloat timeValue = 1.5; @@ -188,13 +188,6 @@ static const CGFloat timeValue = 1.5;
188 }]; 188 }];
189 } 189 }
190 190
191 -#pragma mark - CNLiveCollectionNavigationBarDelegate  
192 -- (void)navigationBar:(CNLiveCollectionNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{  
193 - if ([actionEvents isEqualToString:@"1"]) {  
194 - [self goBack];  
195 - }  
196 -}  
197 -  
198 #pragma mark - 懒加载 191 #pragma mark - 懒加载
199 - (NSMutableArray *)data { 192 - (NSMutableArray *)data {
200 if (!_data) { 193 if (!_data) {
@@ -232,11 +225,16 @@ static const CGFloat timeValue = 1.5; @@ -232,11 +225,16 @@ static const CGFloat timeValue = 1.5;
232 } 225 }
233 return _tableView; 226 return _tableView;
234 } 227 }
235 -- (CNLiveCollectionNavigationBar *)navigationBar { 228 +- (CNLiveNavigationBar *)navigationBar {
236 if (!_navigationBar) { 229 if (!_navigationBar) {
237 - _navigationBar = [[CNLiveCollectionNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];  
238 - _navigationBar.delegate = self; 230 + _navigationBar = [CNLiveNavigationBar navigationBar];
239 _navigationBar.title.text = @"我的收藏"; 231 _navigationBar.title.text = @"我的收藏";
  232 + __weak __typeof(self)weakSelf = self;
  233 + _navigationBar.onClickLeftButton = ^{
  234 + __strong typeof(weakSelf) strongSelf = weakSelf;
  235 + if(!strongSelf) return ;
  236 + [strongSelf goBack];
  237 + };
240 } 238 }
241 return _navigationBar; 239 return _navigationBar;
242 } 240 }
CNLiveCollectionModule/Classes/View/CNLiveCollectionNavigationBar.h deleted 100644 → 0
1 -//  
2 -// CNLiveCollectionNavigationBar.m  
3 -// CNLiveCollectionModule  
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 CNLiveCollectionNavigationBar;  
13 -  
14 -@protocol CNLiveCollectionNavigationBarDelegate <NSObject>  
15 -- (void)navigationBar:(CNLiveCollectionNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents;  
16 -  
17 -@end  
18 -  
19 -@interface CNLiveCollectionNavigationBar : UIView  
20 -@property (nonatomic, weak) id<CNLiveCollectionNavigationBarDelegate> 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  
CNLiveCollectionModule/Classes/View/CNLiveCollectionNavigationBar.m deleted 100644 → 0
1 -//  
2 -// CNLiveCollectionNavigationBar.m  
3 -// CNLiveCollectionModule  
4 -//  
5 -// Created by 153993236@qq.com on 11/12/2019.  
6 -// Copyright © 2019 153993236@qq.com. All rights reserved.  
7 -//  
8 -  
9 -#import "CNLiveCollectionNavigationBar.h"  
10 -#import "QMUIKit.h"  
11 -#import "CNLiveCategory.h"  
12 -  
13 -@interface CNLiveCollectionNavigationBar ()  
14 -  
15 -@end  
16 -  
17 -@implementation CNLiveCollectionNavigationBar  
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(@"CNLiveSettingNavigationBar -- 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 whiteColor];  
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:@"collection_back_black_b" bundleName:@"CNLiveCollectionModule" 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 blackColor];  
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 -- (void)rightDidClicked:(UIButton *)btn{  
102 - if (self.delegate && [self.delegate respondsToSelector:@selector(navigationBar:actionEvents:)]) {  
103 - [self.delegate navigationBar:self actionEvents:@"2"];  
104 - }  
105 -}  
106 -  
107 -@end  
Example/CNLiveCollectionModule.xcodeproj/project.pbxproj
@@ -356,6 +356,7 @@ @@ -356,6 +356,7 @@
356 "${BUILT_PRODUCTS_DIR}/CNLiveCollectionModule/CNLiveCollectionModule.framework", 356 "${BUILT_PRODUCTS_DIR}/CNLiveCollectionModule/CNLiveCollectionModule.framework",
357 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework", 357 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
358 "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework", 358 "${BUILT_PRODUCTS_DIR}/CNLiveCommonClass/CNLiveCommonClass.framework",
  359 + "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework",
359 "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework", 360 "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework",
360 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", 361 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
361 "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", 362 "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework",
@@ -378,6 +379,7 @@ @@ -378,6 +379,7 @@
378 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCollectionModule.framework", 379 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCollectionModule.framework",
379 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework", 380 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
380 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework", 381 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonClass.framework",
  382 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework",
381 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework", 383 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework",
382 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", 384 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
383 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", 385 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework",