Commit c60401c916692661720b0e97ee3afe562a61fc4f

Authored by yanglingyu
1 parent 7386f065

更改提交

CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.h
... ... @@ -5,7 +5,7 @@
5 5 // Created by CNLive on 2021/8/7.
6 6 //
7 7  
8   -#import <CNLiveBaseClass/CNLiveBaseClass.h>
  8 +#import <CNLiveBaseClass/CNLiveBaseViewController.h>
9 9  
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
... ...
CNLiveVideoClassifyKit/Classes/Controller/CnLiveSubClassifySegmentController.h
... ... @@ -5,7 +5,7 @@
5 5 // Created by CNLive on 2021/8/7.
6 6 //
7 7  
8   -#import <CNLiveBaseClass/CNLiveBaseClass.h>
  8 +#import <CNLiveBaseClass/CNLiveBaseViewController.h>
9 9  
10 10 NS_ASSUME_NONNULL_BEGIN
11 11  
... ...
Example/CNLiveVideoClassifyKit.xcodeproj/project.pbxproj
... ... @@ -7,6 +7,7 @@
7 7 objects = {
8 8  
9 9 /* Begin PBXBuildFile section */
  10 + 0816338F26BE298900B076D6 /* CNliveCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */; };
10 11 14963F4E510A1E5865D15ED8 /* Pods_CNLiveVideoClassifyKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7743536FE5FB6796BFAA55B5 /* Pods_CNLiveVideoClassifyKit_Tests.framework */; };
11 12 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
12 13 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
... ... @@ -37,6 +38,8 @@
37 38 /* End PBXContainerItemProxy section */
38 39  
39 40 /* Begin PBXFileReference section */
  41 + 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNliveCollectionViewCell.h; sourceTree = "<group>"; };
  42 + 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNliveCollectionViewCell.m; sourceTree = "<group>"; };
40 43 24BF123CDE580DC9CCCE1718 /* Pods-CNLiveVideoClassifyKit_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.release.xcconfig"; sourceTree = "<group>"; };
41 44 3A8AB8DB19B4EF9ACF33573D /* Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Tests/Pods-CNLiveVideoClassifyKit_Tests.release.xcconfig"; sourceTree = "<group>"; };
42 45 5793570C0C400C4B3B4942CE /* Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; path = "Target Support Files/Pods-CNLiveVideoClassifyKit_Example/Pods-CNLiveVideoClassifyKit_Example.debug.xcconfig"; sourceTree = "<group>"; };
... ... @@ -137,6 +140,8 @@
137 140 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
138 141 6003F5A5195388D20070C39A /* CNLIVEViewController.h */,
139 142 6003F5A6195388D20070C39A /* CNLIVEViewController.m */,
  143 + 0816338D26BE298900B076D6 /* CNliveCollectionViewCell.h */,
  144 + 0816338E26BE298900B076D6 /* CNliveCollectionViewCell.m */,
140 145 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */,
141 146 6003F5A8195388D20070C39A /* Images.xcassets */,
142 147 6003F594195388D20070C39A /* Supporting Files */,
... ... @@ -387,6 +392,7 @@
387 392 buildActionMask = 2147483647;
388 393 files = (
389 394 6003F59E195388D20070C39A /* CNLIVEAppDelegate.m in Sources */,
  395 + 0816338F26BE298900B076D6 /* CNliveCollectionViewCell.m in Sources */,
390 396 6003F5A7195388D20070C39A /* CNLIVEViewController.m in Sources */,
391 397 6003F59A195388D20070C39A /* main.m in Sources */,
392 398 );
... ...
Example/CNLiveVideoClassifyKit/CNLIVEViewController.m
... ... @@ -7,9 +7,16 @@
7 7 //
8 8  
9 9 #import "CNLIVEViewController.h"
  10 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  11 +#import "CNliveCollectionViewCell.h"
10 12  
11   -@interface CNLIVEViewController ()
12 13  
  14 +
  15 +@interface CNLIVEViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
  16 +{
  17 + NSArray *segArr;
  18 +}
  19 +@property (nonatomic, strong)UICollectionView *collectionView;
13 20 @end
14 21  
15 22 @implementation CNLIVEViewController
... ... @@ -17,9 +24,51 @@
17 24 - (void)viewDidLoad
18 25 {
19 26 [super viewDidLoad];
20   - // Do any additional setup after loading the view, typically from a nib.
  27 + segArr = @[@"分类"];
  28 + [self.view addSubview:self.collectionView];
  29 +}
  30 +#pragma mrk - UICollectionViewDataSource
  31 +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  32 +{
  33 + return segArr.count;
21 34 }
22 35  
  36 +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  37 +{
  38 + CNliveCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuseCell" forIndexPath:indexPath];
  39 + cell.titleName = segArr[indexPath.row];
  40 + return cell;
  41 +}
  42 +#pragma mark - UICollectionViewDelegate
  43 +-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
  44 +{
  45 + switch (indexPath.row) {
  46 + case 0:
  47 + {
  48 +
  49 + }
  50 + break;
  51 +
  52 + default:
  53 + break;
  54 + }
  55 +}
  56 +#pragma mark - Getting
  57 +-(UICollectionView *)collectionView
  58 +{
  59 + if (!_collectionView) {
  60 + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  61 + layout.itemSize = CGSizeMake(100, 40);
  62 + layout.minimumLineSpacing = 10;
  63 + layout.minimumInteritemSpacing = 10;
  64 + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) collectionViewLayout:layout];
  65 + [_collectionView registerClass:[CNliveCollectionViewCell class] forCellWithReuseIdentifier:@"reuseCell"];
  66 + _collectionView.delegate = self;
  67 + _collectionView.backgroundColor = [UIColor whiteColor];
  68 + _collectionView.dataSource = self;
  69 + }
  70 + return _collectionView;
  71 +}
23 72 - (void)didReceiveMemoryWarning
24 73 {
25 74 [super didReceiveMemoryWarning];
... ...
Example/CNLiveVideoClassifyKit/CNliveCollectionViewCell.h 0 → 100644
  1 +//
  2 +// CNliveCollectionViewCell.h
  3 +// CNLiveVideoClassifyKit_Example
  4 +//
  5 +// Created by CNLive on 2021/8/7.
  6 +// Copyright © 2021 杨苓玉. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNliveCollectionViewCell : UICollectionViewCell
  14 +@property (nonatomic, strong)NSString *titleName;
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
... ...
Example/CNLiveVideoClassifyKit/CNliveCollectionViewCell.m 0 → 100644
  1 +//
  2 +// CNliveCollectionViewCell.m
  3 +// CNLiveVideoClassifyKit_Example
  4 +//
  5 +// Created by CNLive on 2021/8/7.
  6 +// Copyright © 2021 杨苓玉. All rights reserved.
  7 +//
  8 +
  9 +#import "CNliveCollectionViewCell.h"
  10 +
  11 +@interface CNliveCollectionViewCell()
  12 +@property (nonatomic, strong)UILabel *titleLabel;
  13 +@end
  14 +
  15 +@implementation CNliveCollectionViewCell
  16 +
  17 +-(instancetype)initWithFrame:(CGRect)frame
  18 +{
  19 + if (self = [super initWithFrame:frame]) {
  20 + self.contentView.backgroundColor = [UIColor lightGrayColor];
  21 + [self.contentView addSubview:self.titleLabel];
  22 + }
  23 + return self;
  24 +}
  25 +-(void)setTitleName:(NSString *)titleName
  26 +{
  27 + self.titleLabel.text = titleName;
  28 +}
  29 +- (UILabel *)titleLabel
  30 +{
  31 + if (!_titleLabel) {
  32 + _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height)];
  33 + _titleLabel.textColor = [UIColor blueColor];
  34 + _titleLabel.textAlignment = NSTextAlignmentCenter;
  35 + }
  36 + return _titleLabel;
  37 +}
  38 +@end
... ...