NYClassRoomVC.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #import "CultivateInfoModel.h"
  12. #import "CultivatePhotoModel.h"
  13. @interface NYClassRoomVC ()
  14. /// viewModel
  15. @property (nonatomic, readonly, strong) NYClassRoomViewModel *viewModel;
  16. @end
  17. @implementation NYClassRoomVC
  18. @dynamic viewModel;
  19. #pragma mark - SystemMethod
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. // Do any additional setup after loading the view.
  23. self.view.backgroundColor = UIColor.whiteColor;
  24. self.collectionView.backgroundColor = UIColor.clearColor;
  25. self.collectionView.backgroundView.backgroundColor = UIColor.clearColor;
  26. UIImageView *bgImageView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"classroom_bgbg"]];
  27. [self.view insertSubview:bgImageView atIndex:0];
  28. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.top.right.mas_equalTo(self.view);
  30. make.height.mas_equalTo(184.f);
  31. }];
  32. }
  33. - (UIColor *)qmui_titleViewTintColor
  34. {
  35. return UIColor.whiteColor;
  36. }
  37. - (UIImage *)qmui_navigationBarBackgroundImage
  38. {
  39. return [UIImage qmui_imageWithColor:UIColor.clearColor];
  40. }
  41. #pragma mark - OverrideMethods
  42. /// 配置collectionView的区域
  43. - (UIEdgeInsets)contentInset {
  44. return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, 0, 0);
  45. }
  46. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  47. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  48. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  49. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  50. }
  51. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  52. [cell bindViewModel:object];
  53. }
  54. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  55. switch (section) {
  56. case 1: {
  57. return UIEdgeInsetsMake(0, 16, 0, 16);
  58. }
  59. default: {
  60. return UIEdgeInsetsZero;
  61. }
  62. }
  63. }
  64. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  65. switch (section) {
  66. case 1:
  67. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  68. default:
  69. return 8;
  70. }
  71. }
  72. @end