Commit 691740b0ff1d89d34048a616a1cf55349d8003d4

Authored by yanglingyu
1 parent 516b3cc5

我的收藏布局逻辑修改0.3.4

CNLiveCMineModule.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveCMineModule'
11   - s.version = '0.3.3'
  11 + s.version = '0.3.4'
12 12 s.summary = '网家家C端个人中心'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveCMineModule/Classes/Colletion/ViewController/CNMineCollectController.h
... ... @@ -8,6 +8,6 @@
8 8 // 收藏
9 9 #import "CNCommonTableViewController.h"
10 10  
11   -@interface CNMineCollectController : CNCommonTableViewController
  11 +@interface CNMineCollectController : CNCommonTableViewController<JXCategoryListContentViewDelegate>
12 12  
13 13 @end
... ...
CNLiveCMineModule/Classes/Colletion/ViewController/CNMineCollectController.m
... ... @@ -287,5 +287,8 @@ static NSString * const kCNLiveWebViewForCollectionRefreshKey = @&quot;kCNLiveWebView
287 287 }
288 288 return _data;
289 289 }
290   -
  290 +#pragma mark - JXCategoryListContentViewDelegate
  291 +- (UIView *)listView{
  292 + return self.view;
  293 +}
291 294 @end
... ...
CNLiveCMineModule/Classes/Colletion/ViewController/CNMineGoodsCollectViewController.h
... ... @@ -10,7 +10,7 @@
10 10  
11 11 NS_ASSUME_NONNULL_BEGIN
12 12  
13   -@interface CNMineGoodsCollectViewController : CNCommonTableViewController
  13 +@interface CNMineGoodsCollectViewController : CNCommonTableViewController<JXCategoryListContentViewDelegate>
14 14  
15 15 @end
16 16  
... ...
CNLiveCMineModule/Classes/Colletion/ViewController/CNMineGoodsCollectViewController.m
... ... @@ -172,6 +172,10 @@
172 172 }];
173 173  
174 174 }
  175 +#pragma mark - JXCategoryListContentViewDelegate
  176 +- (UIView *)listView{
  177 + return self.view;
  178 +}
175 179 /*
176 180 #pragma mark - Navigation
177 181  
... ...
CNLiveCMineModule/Classes/Colletion/ViewController/CNMineTotleCollectViewController.m
... ... @@ -13,9 +13,9 @@
13 13 #import "UIColor+CNLiveExtension.h"
14 14 #import "UIViewController+CNLivePhotoBrowserStatusBar.h"
15 15  
16   -@interface CNMineTotleCollectViewController ()<JXCategoryViewDelegate,UIScrollViewDelegate>
  16 +@interface CNMineTotleCollectViewController ()<JXCategoryViewDelegate,UIScrollViewDelegate,JXCategoryListContainerViewDelegate>
17 17 @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
18   -@property (nonatomic, strong) UIScrollView *scrollView;
  18 +@property (nonatomic, strong) JXCategoryListContainerView *contaimerView;
19 19 @property (nonatomic, strong) NSArray *titles;
20 20 @end
21 21  
... ... @@ -26,7 +26,11 @@ static const CGFloat height = 44;
26 26 self.title = @"收藏";
27 27 self.view.backgroundColor = CNLiveColorWithHexString(@"#F2F2F2");
28 28 [self.view addSubview:self.titleCategoryView];
29   - [self.view addSubview:self.scrollView];
  29 + [self.view addSubview:self.contaimerView];
  30 + [self.contaimerView mas_makeConstraints:^(MASConstraintMaker *make) {
  31 + make.left.right.bottom.equalTo(self.view);
  32 + make.top.equalTo(self.titleCategoryView.mas_bottom);
  33 + }];
30 34 // Do any additional setup after loading the view.
31 35 }
32 36 -(void)viewWillAppear:(BOOL)animated
... ... @@ -50,7 +54,16 @@ static const CGFloat height = 44;
50 54 // }
51 55 // [self addCNLiveStat];
52 56 }
53   -
  57 +- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
  58 + return self.titles.count;
  59 +}
  60 +- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
  61 + if (index == 0) {
  62 + return [[CNMineCollectController alloc]init];
  63 + }else{
  64 + return [[CNMineGoodsCollectViewController alloc]init];
  65 + }
  66 +}
54 67 #pragma mark - 懒加载
55 68 - (JXCategoryTitleView *)titleCategoryView{
56 69 if (!_titleCategoryView) {
... ... @@ -66,12 +79,12 @@ static const CGFloat height = 44;
66 79 _titleCategoryView.titleLabelZoomScale = 1.0;
67 80 _titleCategoryView.titleLabelZoomEnabled = YES;
68 81 _titleCategoryView.titleColorGradientEnabled = YES;
  82 + _titleCategoryView.listContainer = self.contaimerView;
69 83  
70 84 JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
71 85 lineView.indicatorColor = UIColorHex(#FC1541);
72 86 lineView.indicatorWidth = 20;
73 87 _titleCategoryView.indicators = @[lineView];
74   - _titleCategoryView.contentScrollView = self.scrollView;
75 88  
76 89 UIView *line = [[UIView alloc] initWithFrame:CGRectMake(KScreenWidth/2-0.2, 14.5, 0.5, 13)];
77 90 line.backgroundColor = UIColorHex(#E6E6E6);
... ... @@ -80,38 +93,13 @@ static const CGFloat height = 44;
80 93 }
81 94 return _titleCategoryView;
82 95 }
83   -
84   -- (UIScrollView *)scrollView {
85   - if (!_scrollView) {
86   - CGFloat scrollW = SCREEN_WIDTH;
87   - CGFloat scrollH = SCREEN_HEIGHT - NavigationContentTop - height;
88   - _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavigationContentTop + height, scrollW, scrollH)];
89   - _scrollView.contentSize = CGSizeMake(scrollW * self.titles.count, scrollH);
90   - _scrollView.pagingEnabled = YES;
91   - _scrollView.bounces = NO;
92   - _scrollView.delegate = self;
93   - _scrollView.showsHorizontalScrollIndicator = NO;
94   - _scrollView.scrollEnabled = YES;
95   - _scrollView.backgroundColor = [UIColor whiteColor];
96   -
97   - for(int i = 0; i < self.titles.count; i++){
98   - UIViewController *vc = nil;
99   - if(i == 0){
100   - vc = [[CNMineCollectController alloc]init];
101   -
102   - }else if (i == 1){
103   - vc = [[CNMineGoodsCollectViewController alloc]init];
104   -
105   - }
106   - vc.view.frame = CGRectMake(i*scrollW, 0, scrollW, scrollH);
107   - [self addChildViewController:vc];
108   - [_scrollView addSubview:vc.view];
109   - }
110   -
  96 +- (JXCategoryListContainerView *)contaimerView
  97 +{
  98 + if (!_contaimerView) {
  99 + _contaimerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
111 100 }
112   - return _scrollView;
  101 + return _contaimerView;
113 102 }
114   -
115 103 - (NSArray *)titles{
116 104 if (!_titles) {
117 105 _titles = [NSArray arrayWithObjects:@"资讯", @"商品", nil];
... ...
Example/CNLiveCMineModule/CNLIVEAppDelegate.m
... ... @@ -28,7 +28,7 @@
28 28  
29 29 [super application:application didFinishLaunchingWithOptions:launchOptions];
30 30  
31   - [CNUserInfoManager manager].userInfoModel.uid = @"353001";//@"10510277";//
  31 + [CNUserInfoManager manager].userInfoModel.uid = @"11174272";//@"10510277";//11174272
32 32  
33 33 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
34 34 self.window.backgroundColor = [UIColor whiteColor];
... ...