// // 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; - (void)dealloc { RQ_Exercise_Module.isShow_CatalogueView = NO; } #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 * 4); } - (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)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.row==2){ //删除 if(self.viewModel.homeSubPageType == RQHomeSubPageType_SequentialPractice){ [NYTools delExerciseListUserKey:RQ_USER_MANAGER.currentUser.outId carType:RQ_YDTQuestion_Module.carType subject:RQ_YDTQuestion_Module.subject exerciseType:RQ_Exercise_Module.currentExerciseType]; [self dismissViewControllerAnimated:YES completion:^{ //跳出当前页 [RQControllerHelper.currentViewController.navigationController popViewControllerAnimated:YES]; }]; } } } - (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 * 5)); } - (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