CNLIVEViewController.m 2.88 KB
//
//  CNLIVEViewController.m
//  CNLiveCMineModule
//
//  Created by 杨苓玉 on 12/21/2021.
//  Copyright (c) 2021 杨苓玉. All rights reserved.
//

#import "CNLIVEViewController.h"
#import "CNLiveCMineModule.h"
#import "CNCollectionViewCell.h"
#import <CNLiveBusinessBaseModule/BaseAppDelegate.h>
@interface CNLIVEViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (nonatomic, strong)UICollectionView *collectionView;
@property (nonatomic, strong)NSArray *dataSource;
@end

@implementation CNLIVEViewController

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.dataSource = @[@"我的", @"积分"];
    [self.view addSubview:self.collectionView];
    QMUICMI.needsBackBarButtonItemTitle = NO;
	// Do any additional setup after loading the view, typically from a nib.
}
- (BOOL)shouldCustomizeNavigationBarTransitionIfHideable
{
    return YES;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
        {
            UIViewController *vc = [CNLiveCMineModule showMineView];
            [[BaseAppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@""];
        }
            break;
        case 1:
        {
            [CNLiveCMineModule pushVCWithInteViewToFrom:@"" Feedback:NO];
        }
            break;
        default:
            break;
    }
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 1;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    return self.dataSource.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CNCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"UICollectionViewCellID" forIndexPath:indexPath];
    cell.titleLabel.text = self.dataSource[indexPath.section];
    return cell;
}
- (UICollectionView *)collectionView
{
    if (!_collectionView) {
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
        layout.itemSize = CGSizeMake(self.view.frame.size.width -40, 44);
        
        _collectionView = [[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:layout];
        _collectionView.backgroundColor = [UIColor whiteColor];
        [_collectionView registerClass:[CNCollectionViewCell class] forCellWithReuseIdentifier:@"UICollectionViewCellID"];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        
    }
    return _collectionView;
}
@end