NYClassRoomVC.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // NYClassRoomVC.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2024/2/4.
  6. // Copyright © 2024 JCZ. All rights reserved.
  7. //
  8. #import "NYClassRoomVC.h"
  9. #import "NYClassRoomViewModel.h"
  10. #import "NYGetjobStartRuleCell.h"
  11. @interface NYClassRoomVC ()
  12. /// viewModel
  13. @property (nonatomic, readonly, strong) NYClassRoomViewModel *viewModel;
  14. @end
  15. @implementation NYClassRoomVC
  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:@"classroom_bgbg"]];
  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. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  48. }
  49. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  50. [cell bindViewModel:object];
  51. }
  52. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  53. switch (section) {
  54. case 1: {
  55. return UIEdgeInsetsMake(0, 16, 0, 16);
  56. }
  57. default: {
  58. return UIEdgeInsetsZero;
  59. }
  60. }
  61. }
  62. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  63. switch (section) {
  64. case 1:
  65. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  66. default:
  67. return 8;
  68. }
  69. }
  70. @end