NYTheoryTimeVC.m 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // NYTheoryTimeVC.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2023/6/8.
  6. // Copyright © 2023 JCZ. All rights reserved.
  7. //
  8. #import "NYTheoryTimeVC.h"
  9. #import "NYTheoryTimeViewModel.h"
  10. #import "NYTimeStartRuleCell.h"
  11. @interface NYTheoryTimeVC ()
  12. /// viewModel
  13. @property (nonatomic, readonly, strong) NYTheoryTimeViewModel *viewModel;
  14. @end
  15. @implementation NYTheoryTimeVC
  16. @dynamic viewModel;
  17. #pragma mark - SystemMethod
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. // Do any additional setup after loading the view.
  21. self.view.backgroundColor = UIColorHex(0x498EF5);
  22. self.collectionView.backgroundColor = UIColorHex(0x498EF5);
  23. self.collectionView.backgroundView.backgroundColor = UIColorHex(0x498EF5);
  24. }
  25. - (UIColor *)qmui_titleViewTintColor
  26. {
  27. return UIColor.whiteColor;
  28. }
  29. - (UIImage *)qmui_navigationBarBackgroundImage
  30. {
  31. return [UIImage qmui_imageWithColor:UIColorHex(0x498EF5)];
  32. }
  33. #pragma mark - OverrideMethods
  34. /// 配置collectionView的区域
  35. - (UIEdgeInsets)contentInset {
  36. return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0 , 0);
  37. }
  38. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  39. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  40. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  41. if([itemViewModel.itemClassName isEqualToString:@"NYTimeStartRuleCell"]){
  42. NYTimeStartRuleCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  43. [cell.time_Button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  44. return cell;
  45. }
  46. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  47. }
  48. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  49. [cell bindViewModel:object];
  50. }
  51. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  52. switch (section) {
  53. case 1: {
  54. return UIEdgeInsetsMake(0, 16, 0, 16);
  55. }
  56. default: {
  57. return UIEdgeInsetsZero;
  58. }
  59. }
  60. }
  61. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  62. switch (section) {
  63. case 1:
  64. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  65. default:
  66. return 8;
  67. }
  68. }
  69. @end