NYGetjobTimeVC.m 3.2 KB

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