TDGroupLabelVC.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // TDGroupLabelVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/8.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "TDGroupLabelVC.h"
  9. #import "TDGroupLabelCell.h"
  10. #import "AddGroupLabelVC.h"
  11. @interface TDGroupLabelVC ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
  12. @property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
  13. @property (weak, nonatomic) IBOutlet UIButton *setBtn;
  14. @end
  15. @implementation TDGroupLabelVC
  16. +(TDGroupLabelVC *)initTDGroupLabelVC{
  17. TDGroupLabelVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupLabelVC"];
  18. return controller;
  19. }
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.fd_prefersNavigationBarHidden = YES;
  23. self.collectionView.delegate = self;
  24. self.collectionView.dataSource = self;
  25. [self.collectionView setCollectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
  26. self.collectionView.showsVerticalScrollIndicator = NO;
  27. self.collectionView.showsHorizontalScrollIndicator = NO;
  28. self.collectionView.contentInset = UIEdgeInsetsMake(2, 30, 0, 24);
  29. [self.collectionView registerNib:[UINib nibWithNibName:@"TDGroupLabelCell" bundle:nil] forCellWithReuseIdentifier:@"TDGroupLabelCell"];
  30. self.collectionView.backgroundColor = [UIColor whiteColor];
  31. [self.collectionView reloadData];
  32. WS(weakSelf);
  33. [self.setBtn setAction:^{
  34. AddGroupLabelVC * vc = [AddGroupLabelVC initAddGroupLabelVC];
  35. [weakSelf presentViewController:vc animated:YES completion:^{
  36. }];
  37. }];
  38. }
  39. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  40. return 1;
  41. }
  42. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  43. return 6;
  44. }
  45. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  46. {
  47. return CGSizeMake((SCREEN_WIDTH - 63) * 0.5, 58.f);
  48. }
  49. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
  50. {
  51. return 7.f;
  52. }
  53. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
  54. {
  55. return 9.f;
  56. }
  57. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  58. TDGroupLabelCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TDGroupLabelCell" forIndexPath:indexPath];
  59. cell.titleL.text = @"语文作文";
  60. cell.deleteBtn.hidden = YES;
  61. return cell;
  62. }
  63. @end