// // TDGroupLabelVC.m // smartRhino // // Created by niuzhen on 2020/5/8. // Copyright © 2020 tederen. All rights reserved. // #import "TDGroupLabelVC.h" #import "TDGroupLabelCell.h" #import "AddGroupLabelVC.h" @interface TDGroupLabelVC () @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; @property (weak, nonatomic) IBOutlet UIButton *setBtn; @end @implementation TDGroupLabelVC +(TDGroupLabelVC *)initTDGroupLabelVC{ TDGroupLabelVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupLabelVC"]; return controller; } - (void)viewDidLoad { [super viewDidLoad]; self.fd_prefersNavigationBarHidden = YES; self.collectionView.delegate = self; self.collectionView.dataSource = self; [self.collectionView setCollectionViewLayout:[[UICollectionViewFlowLayout alloc] init]]; self.collectionView.showsVerticalScrollIndicator = NO; self.collectionView.showsHorizontalScrollIndicator = NO; self.collectionView.contentInset = UIEdgeInsetsMake(2, 30, 0, 24); [self.collectionView registerNib:[UINib nibWithNibName:@"TDGroupLabelCell" bundle:nil] forCellWithReuseIdentifier:@"TDGroupLabelCell"]; self.collectionView.backgroundColor = [UIColor whiteColor]; [self.collectionView reloadData]; WS(weakSelf); [self.setBtn setAction:^{ AddGroupLabelVC * vc = [AddGroupLabelVC initAddGroupLabelVC]; [weakSelf presentViewController:vc animated:YES completion:^{ }]; }]; } - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 6; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake((SCREEN_WIDTH - 63) * 0.5, 58.f); } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 7.f; } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { return 9.f; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { TDGroupLabelCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TDGroupLabelCell" forIndexPath:indexPath]; cell.titleL.text = @"语文作文"; cell.deleteBtn.hidden = YES; return cell; } @end