// // RQRetrainOrderViewController.m // jiaPei // // Created by 张嵘 on 2022/4/18. // Copyright © 2022 JCZ. All rights reserved. // #import "RQRetrainOrderViewController.h" @interface RQRetrainOrderViewController () /// viewModel @property (nonatomic, readonly, strong) RQRetrainOrderViewModel *viewModel; @property (nonatomic, readwrite, strong) RQHeadImageView *headImageView; @end @implementation RQRetrainOrderViewController @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; /// 初始化 [self rq_setup]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; } - (void)dealloc { } #pragma mark - PrivateMethods /// 初始化 - (void)rq_setup { } /// 配置tableView的区域 - (UIEdgeInsets)contentInset { return UIEdgeInsetsMake(0, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0); } - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath { switch (indexPath.section) { case 0 : { return [RQRetrainChooseCell cellWithTableView:tableView]; } default: return [super tableView:tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath]; } } - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { switch (indexPath.section) { case 0 : { RQRetrainChooseCell *retrainChooseCell = (RQRetrainChooseCell *)cell; [retrainChooseCell bindViewModel:object]; break; } default: [super configureCell:cell atIndexPath:indexPath withObject:object]; break; } } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { switch (section) { case 0 : { RQCommonHeaderView *headerView = [RQCommonHeaderView headerViewWithTableView:tableView]; RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[section]; headerView.backgroundColor = UIColor.whiteColor; [headerView bindViewModel:groupViewModel]; return headerView; } default: return [super tableView:tableView viewForHeaderInSection:section]; } } #pragma mark - HWPanModalPresentable - (UIScrollView *)panScrollable { return self.tableView; } - (PresentationState)originPresentationState { return PresentationStateShort; } - (PanModalHeight)longFormHeight { return PanModalHeightMake(PanModalHeightTypeMaxTopInset, RQHeightForPinSectionHeaderInPagerView); } - (CGFloat)cornerRadius { return 13.3; } - (PanModalHeight)shortFormHeight { return PanModalHeightMake(PanModalHeightTypeContent, 59 + 167 - RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT); } - (PanModalHeight)mediumFormHeight { return PanModalHeightMake(PanModalHeightTypeMaxTopInset, (RQ_SCREEN_HEIGHT - RQHeightForPinSectionHeaderInPagerView - RQ_APPLICATION_STATUS_BAR_HEIGHT) / 2.f); } - (CGFloat)topOffset { return self.topLayoutOffset; } - (BOOL)anchorModalToLongForm { return NO; } - (HWPanModalShadow*)contentShadow { HWPanModalShadow *shadow = [HWPanModalShadow new]; shadow.shadowColor = [UIColor blackColor]; shadow.shadowOpacity = 0.5; shadow.shadowRadius = 6.0; shadow.shadowOffset = CGSizeMake(0, 2); return shadow; } - (BOOL)allowsDragToDismiss { return NO; } - (BOOL)allowsTapBackgroundToDismiss { return NO; } - (BOOL)isUserInteractionEnabled { return YES; } - (BOOL)showDragIndicator { return YES; } - (BOOL)allowsTouchEventsPassingThroughTransitionView { return YES; } - (nullable UIView *)customIndicatorView { return self.headImageView; } - (HWBackgroundConfig *)backgroundConfig { HWBackgroundConfig *backgroundConfig; backgroundConfig = [HWBackgroundConfig configWithBehavior:HWBackgroundBehaviorDefault]; backgroundConfig.backgroundAlpha = 0.f; return backgroundConfig; } #pragma mark - LazyLoad - (RQHeadImageView *)headImageView { if (!_headImageView) { _headImageView = [[RQHeadImageView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH, 54.f)]; } return _headImageView; } @end