NYTheoryTimeVC.m 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. self.timeLabel = cell.time_Label;
  45. self.on_offBtn = cell.time_Button;
  46. return cell;
  47. }
  48. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  49. }
  50. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  51. [cell bindViewModel:object];
  52. }
  53. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  54. switch (section) {
  55. case 1: {
  56. return UIEdgeInsetsMake(0, 16, 0, 16);
  57. }
  58. default: {
  59. return UIEdgeInsetsZero;
  60. }
  61. }
  62. }
  63. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  64. switch (section) {
  65. case 1:
  66. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  67. default:
  68. return 8;
  69. }
  70. }
  71. @end