// // NYGetjobTimeVC.m // jiaPei // // Created by Ning.ge on 2023/6/8. // Copyright © 2023 JCZ. All rights reserved. // #import "NYGetjobTimeVC.h" #import "NYGetjobTimeViewModel.h" #import "NYGetjobStartRuleCell.h" @interface NYGetjobTimeVC () /// viewModel @property (nonatomic, readonly, strong) NYGetjobTimeViewModel *viewModel; @end @implementation NYGetjobTimeVC @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = UIColor.whiteColor; self.collectionView.backgroundColor = UIColor.clearColor; self.collectionView.backgroundView.backgroundColor = UIColor.clearColor; UIImageView *bgImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"背景bg_top"]]; [self.view insertSubview:bgImageView atIndex:0]; [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.mas_equalTo(self.view); make.height.mas_equalTo(184.f); }]; } - (UIColor *)qmui_titleViewTintColor { return UIColor.whiteColor; } - (UIImage *)qmui_navigationBarBackgroundImage { return [UIImage qmui_imageWithColor:UIColor.clearColor]; } #pragma mark - OverrideMethods /// 配置collectionView的区域 - (UIEdgeInsets)contentInset { return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0, 0); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath { RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section]; RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row]; if([itemViewModel.itemClassName isEqualToString:@"NYGetjobStartRuleCell"]){ NYGetjobStartRuleCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath]; [cell cellUpdateView:self.viewModel.subject_array]; [cell.time_Button addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; self.timeLabel = cell.time_Label; self.on_offBtn = cell.time_Button; return cell; } return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath]; } - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { [cell bindViewModel:object]; } - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { switch (section) { case 1: { return UIEdgeInsetsMake(0, 16, 0, 16); } default: { return UIEdgeInsetsZero; } } } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section { switch (section) { case 1: return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f; default: return 8; } } @end