// // RQExerciseSettingViewController.m // JSJP // // Created by RONGQING on 2022/1/14. // #import "RQExerciseSettingViewController.h" @interface RQExerciseSettingViewController () /// viewModel @property (nonatomic, readonly, strong) RQExerciseSettingViewModel *viewModel; @property (nonatomic, readwrite, strong) RQExerciseSettingHeaderView *exerciseSettingHeaderView; @end @implementation RQExerciseSettingViewController @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; [self.view addSubview:self.exerciseSettingHeaderView]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; self.exerciseSettingHeaderView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, 44.f); self.tableView.frame = CGRectMake(0, 44, RQ_SCREEN_WIDTH, 44 * 3); } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self hw_panModalSetNeedsLayoutUpdate]; } #pragma mark - OverrideMethods /// 配置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.row) { case 1 : { return [RQExerciseSettingCell cellWithTableView:tableView]; } default: return [super tableView:tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath]; } } - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { switch (indexPath.row) { case 1 : { RQExerciseSettingCell *exerciseSettingCell = (RQExerciseSettingCell *)cell; [exerciseSettingCell bindViewModel:object]; break; } default: [super configureCell:cell atIndexPath:indexPath withObject:object]; break; } } #pragma mark - HWPanModalPresentable - (UIScrollView *)panScrollable { return self.tableView; } - (PanModalHeight)longFormHeight { return PanModalHeightMake(PanModalHeightTypeMaxTopInset, RQ_SCREEN_HEIGHT - RQ_APPLICATION_NAV_BAR_HEIGHT - RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT - (44 * 4)); } - (CGFloat)cornerRadius { return 0.0; } - (BOOL)allowsTapBackgroundToDismiss { return NO; } - (BOOL)showDragIndicator { return NO; } - (BOOL)allowsDragToDismiss { return NO; } - (BOOL)allowsPullDownWhenShortState { return NO; } #pragma mark - LazyLoad - (RQExerciseSettingHeaderView *)exerciseSettingHeaderView { if (!_exerciseSettingHeaderView) { @weakify(self) _exerciseSettingHeaderView = [RQExerciseSettingHeaderView exerciseSettingHeaderView]; [_exerciseSettingHeaderView.completeBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) { @strongify(self) [self dismissViewControllerAnimated:YES completion:^{ }]; }]; [_exerciseSettingHeaderView.cancleBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) { @strongify(self) [self dismissViewControllerAnimated:YES completion:^{ }]; }]; } return _exerciseSettingHeaderView; } @end