RQRetrainOrderViewController.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //
  2. // RQRetrainOrderViewController.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/4/18.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQRetrainOrderViewController.h"
  9. @interface RQRetrainOrderViewController ()
  10. /// viewModel
  11. @property (nonatomic, readonly, strong) RQRetrainOrderViewModel *viewModel;
  12. @property (nonatomic, readwrite, strong) RQHeadImageView *headImageView;
  13. @end
  14. @implementation RQRetrainOrderViewController
  15. @dynamic viewModel;
  16. #pragma mark - SystemMethod
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. /// 初始化
  20. [self rq_setup];
  21. }
  22. - (void)viewDidLayoutSubviews {
  23. [super viewDidLayoutSubviews];
  24. }
  25. - (void)dealloc {
  26. }
  27. #pragma mark - PrivateMethods
  28. /// 初始化
  29. - (void)rq_setup {
  30. }
  31. /// 配置tableView的区域
  32. - (UIEdgeInsets)contentInset {
  33. return UIEdgeInsetsMake(0, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0);
  34. }
  35. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  36. switch (indexPath.section) {
  37. case 0 : {
  38. return [RQRetrainChooseCell cellWithTableView:tableView];
  39. }
  40. default:
  41. return [super tableView:tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
  42. }
  43. }
  44. - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  45. switch (indexPath.section) {
  46. case 0 : {
  47. RQRetrainChooseCell *retrainChooseCell = (RQRetrainChooseCell *)cell;
  48. [retrainChooseCell bindViewModel:object];
  49. break;
  50. }
  51. default:
  52. [super configureCell:cell atIndexPath:indexPath withObject:object];
  53. break;
  54. }
  55. }
  56. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  57. switch (section) {
  58. case 0 : {
  59. RQCommonHeaderView *headerView = [RQCommonHeaderView headerViewWithTableView:tableView];
  60. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[section];
  61. headerView.backgroundColor = UIColor.whiteColor;
  62. [headerView bindViewModel:groupViewModel];
  63. return headerView;
  64. }
  65. default:
  66. return [super tableView:tableView viewForHeaderInSection:section];
  67. }
  68. }
  69. #pragma mark - HWPanModalPresentable
  70. - (UIScrollView *)panScrollable {
  71. return self.tableView;
  72. }
  73. - (PresentationState)originPresentationState {
  74. return PresentationStateShort;
  75. }
  76. - (PanModalHeight)longFormHeight {
  77. return PanModalHeightMake(PanModalHeightTypeMaxTopInset, RQHeightForPinSectionHeaderInPagerView);
  78. }
  79. - (CGFloat)cornerRadius {
  80. return 13.3;
  81. }
  82. - (PanModalHeight)shortFormHeight {
  83. return PanModalHeightMake(PanModalHeightTypeContent, 59 + 167 - RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT);
  84. }
  85. - (PanModalHeight)mediumFormHeight {
  86. return PanModalHeightMake(PanModalHeightTypeMaxTopInset, (RQ_SCREEN_HEIGHT - RQHeightForPinSectionHeaderInPagerView - RQ_APPLICATION_STATUS_BAR_HEIGHT) / 2.f);
  87. }
  88. - (CGFloat)topOffset {
  89. return self.topLayoutOffset;
  90. }
  91. - (BOOL)anchorModalToLongForm {
  92. return NO;
  93. }
  94. - (HWPanModalShadow)contentShadow {
  95. return PanModalShadowMake([UIColor blackColor], 10, CGSizeMake(0, 2), 1);
  96. }
  97. - (BOOL)allowsDragToDismiss {
  98. return NO;
  99. }
  100. - (BOOL)allowsTapBackgroundToDismiss {
  101. return NO;
  102. }
  103. - (BOOL)isUserInteractionEnabled {
  104. return YES;
  105. }
  106. - (BOOL)showDragIndicator {
  107. return YES;
  108. }
  109. - (BOOL)allowsTouchEventsPassingThroughTransitionView {
  110. return YES;
  111. }
  112. - (nullable UIView <HWPanModalIndicatorProtocol> *)customIndicatorView {
  113. return self.headImageView;
  114. }
  115. - (HWBackgroundConfig *)backgroundConfig {
  116. HWBackgroundConfig *backgroundConfig;
  117. backgroundConfig = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
  118. backgroundConfig.backgroundAlpha = 0.f;
  119. return backgroundConfig;
  120. }
  121. #pragma mark - LazyLoad
  122. - (RQHeadImageView *)headImageView {
  123. if (!_headImageView) {
  124. _headImageView = [[RQHeadImageView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH, 54.f)];
  125. }
  126. return _headImageView;
  127. }
  128. @end