RQRetrainOrderViewController.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. HWPanModalShadow *shadow = [HWPanModalShadow new];
  96. shadow.shadowColor = [UIColor blackColor];
  97. shadow.shadowOpacity = 0.5;
  98. shadow.shadowRadius = 6.0;
  99. shadow.shadowOffset = CGSizeMake(0, 2);
  100. return shadow;
  101. }
  102. - (BOOL)allowsDragToDismiss {
  103. return NO;
  104. }
  105. - (BOOL)allowsTapBackgroundToDismiss {
  106. return NO;
  107. }
  108. - (BOOL)isUserInteractionEnabled {
  109. return YES;
  110. }
  111. - (BOOL)showDragIndicator {
  112. return YES;
  113. }
  114. - (BOOL)allowsTouchEventsPassingThroughTransitionView {
  115. return YES;
  116. }
  117. - (nullable UIView <HWPanModalIndicatorProtocol> *)customIndicatorView {
  118. return self.headImageView;
  119. }
  120. - (HWBackgroundConfig *)backgroundConfig {
  121. HWBackgroundConfig *backgroundConfig;
  122. backgroundConfig = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault];
  123. backgroundConfig.backgroundAlpha = 0.f;
  124. return backgroundConfig;
  125. }
  126. #pragma mark - LazyLoad
  127. - (RQHeadImageView *)headImageView {
  128. if (!_headImageView) {
  129. _headImageView = [[RQHeadImageView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH, 54.f)];
  130. }
  131. return _headImageView;
  132. }
  133. @end