NYTheoryTimeVC.m 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // NYTheoryTimeVC.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2023/6/8.
  6. // Copyright © 2023 JCZ. All rights reserved.
  7. //
  8. #import "NYTheoryTimeVC.h"
  9. #import "NYTheoryTimeViewModel.h"
  10. @interface NYTheoryTimeVC ()
  11. /// viewModel
  12. @property (nonatomic, readonly, strong) NYTheoryTimeViewModel *viewModel;
  13. @end
  14. @implementation NYTheoryTimeVC
  15. @dynamic viewModel;
  16. #pragma mark - SystemMethod
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. // Do any additional setup after loading the view.
  20. self.view.backgroundColor = UIColorHex(0x498EF5);
  21. self.collectionView.backgroundColor = UIColorHex(0x498EF5);
  22. self.collectionView.backgroundView.backgroundColor = UIColorHex(0x498EF5);
  23. }
  24. - (UIColor *)qmui_titleViewTintColor
  25. {
  26. return UIColor.whiteColor;
  27. }
  28. - (UIImage *)qmui_navigationBarBackgroundImage
  29. {
  30. return [UIImage qmui_imageWithColor:UIColorHex(0x498EF5)];
  31. }
  32. #pragma mark - OverrideMethods
  33. /// 配置collectionView的区域
  34. - (UIEdgeInsets)contentInset {
  35. return UIEdgeInsetsMake(RQ_APPLICATION_STATUS_BAR_HEIGHT + RQ_APPLICATION_NAV_BAR_HEIGHT, 0, RQ_APPLICATION_TAB_BAR_HEIGHT + RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0);
  36. }
  37. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  38. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  39. RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  40. return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
  41. }
  42. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  43. [cell bindViewModel:object];
  44. }
  45. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
  46. switch (section) {
  47. case 1: {
  48. return UIEdgeInsetsMake(0, 16, 0, 16);
  49. }
  50. default: {
  51. return UIEdgeInsetsZero;
  52. }
  53. }
  54. }
  55. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
  56. switch (section) {
  57. case 1:
  58. return (RQ_SCREEN_WIDTH - 32 - (RQ_FIT_HORIZONTAL(90.f) * 3)) / 2.f;
  59. default:
  60. return 8;
  61. }
  62. }
  63. @end