NYGetjobTimeVC.m 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // NYGetjobTimeVC.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2023/6/8.
  6. // Copyright © 2023 JCZ. All rights reserved.
  7. //
  8. #import "NYGetjobTimeVC.h"
  9. #import "NYGetjobTimeViewModel.h"
  10. #import "NYGetjobStartRuleCell.h"
  11. @interface NYGetjobTimeVC ()
  12. /// viewModel
  13. @property (nonatomic, readonly, strong) NYGetjobTimeViewModel *viewModel;
  14. @end
  15. @implementation NYGetjobTimeVC
  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 = UIColor.whiteColor;
  22. self.collectionView.backgroundColor = UIColor.clearColor;
  23. self.collectionView.backgroundView.backgroundColor = UIColor.clearColor;
  24. UIImageView *bgImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"背景bg_top"]];
  25. [self.view insertSubview:bgImageView atIndex:0];
  26. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.left.top.right.mas_equalTo(self.view);
  28. make.height.mas_equalTo(184.f);
  29. }];
  30. }
  31. - (UIColor *)qmui_titleViewTintColor
  32. {
  33. return UIColor.whiteColor;
  34. }
  35. - (UIImage *)qmui_navigationBarBackgroundImage
  36. {
  37. return [UIImage qmui_imageWithColor:UIColor.clearColor];
  38. }
  39. #pragma mark - OverrideMethods
  40. /// 配置collectionView的区域
  41. - (UIEdgeInsets)contentInset {
  42. return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0, 0);
  43. }
  44. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  45. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  46. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  47. if([itemViewModel.itemClassName isEqualToString:@"NYGetjobStartRuleCell"]){
  48. NYGetjobStartRuleCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  49. [cell cellUpdateView:self.viewModel.subject_array];
  50. [cell.time_Button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  51. self.timeLabel = cell.time_Label;
  52. self.on_offBtn = cell.time_Button;
  53. return cell;
  54. }
  55. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  56. }
  57. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  58. [cell bindViewModel:object];
  59. }
  60. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  61. switch (section) {
  62. case 1: {
  63. return UIEdgeInsetsMake(0, 16, 0, 16);
  64. }
  65. default: {
  66. return UIEdgeInsetsZero;
  67. }
  68. }
  69. }
  70. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  71. switch (section) {
  72. case 1:
  73. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  74. default:
  75. return 8;
  76. }
  77. }
  78. @end