RQExerciseSettingViewController.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //
  2. // RQExerciseSettingViewController.m
  3. // JSJP
  4. //
  5. // Created by RONGQING on 2022/1/14.
  6. //
  7. #import "RQExerciseSettingViewController.h"
  8. @interface RQExerciseSettingViewController ()
  9. /// viewModel
  10. @property (nonatomic, readonly, strong) RQExerciseSettingViewModel *viewModel;
  11. @property (nonatomic, readwrite, strong) RQExerciseSettingHeaderView *exerciseSettingHeaderView;
  12. @end
  13. @implementation RQExerciseSettingViewController
  14. @dynamic viewModel;
  15. - (void)dealloc {
  16. RQ_Exercise_Module.isShow_CatalogueView = NO;
  17. }
  18. #pragma mark - SystemMethod
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. [self.view addSubview:self.exerciseSettingHeaderView];
  22. }
  23. - (void)viewDidLayoutSubviews {
  24. [super viewDidLayoutSubviews];
  25. self.exerciseSettingHeaderView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, 44.f);
  26. self.tableView.frame = CGRectMake(0, 44, RQ_SCREEN_WIDTH, 44 * 3);
  27. }
  28. - (void)viewDidAppear:(BOOL)animated {
  29. [super viewDidAppear:animated];
  30. [self hw_panModalSetNeedsLayoutUpdate];
  31. }
  32. #pragma mark - OverrideMethods
  33. /// 配置tableView的区域
  34. - (UIEdgeInsets)contentInset {
  35. return UIEdgeInsetsMake(0, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0);
  36. }
  37. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  38. switch (indexPath.row) {
  39. case 1 : {
  40. return [RQExerciseSettingCell cellWithTableView:tableView];
  41. }
  42. default:
  43. return [super tableView:tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
  44. }
  45. }
  46. - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  47. switch (indexPath.row) {
  48. case 1 : {
  49. RQExerciseSettingCell *exerciseSettingCell = (RQExerciseSettingCell *)cell;
  50. [exerciseSettingCell bindViewModel:object];
  51. break;
  52. }
  53. default:
  54. [super configureCell:cell atIndexPath:indexPath withObject:object];
  55. break;
  56. }
  57. }
  58. #pragma mark - HWPanModalPresentable
  59. - (UIScrollView *)panScrollable {
  60. return self.tableView;
  61. }
  62. - (PanModalHeight)longFormHeight {
  63. return PanModalHeightMake(PanModalHeightTypeMaxTopInset, RQ_SCREEN_HEIGHT - RQ_APPLICATION_NAV_BAR_HEIGHT - RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT - (44 * 4));
  64. }
  65. - (CGFloat)cornerRadius {
  66. return 0.0;
  67. }
  68. - (BOOL)allowsTapBackgroundToDismiss {
  69. return NO;
  70. }
  71. - (BOOL)showDragIndicator {
  72. return NO;
  73. }
  74. - (BOOL)allowsDragToDismiss {
  75. return NO;
  76. }
  77. - (BOOL)allowsPullDownWhenShortState {
  78. return NO;
  79. }
  80. #pragma mark - LazyLoad
  81. - (RQExerciseSettingHeaderView *)exerciseSettingHeaderView {
  82. if (!_exerciseSettingHeaderView) {
  83. @weakify(self)
  84. _exerciseSettingHeaderView = [RQExerciseSettingHeaderView exerciseSettingHeaderView];
  85. [_exerciseSettingHeaderView.completeBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  86. @strongify(self)
  87. [self dismissViewControllerAnimated:YES completion:^{
  88. }];
  89. }];
  90. [_exerciseSettingHeaderView.cancleBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  91. @strongify(self)
  92. [self dismissViewControllerAnimated:YES completion:^{
  93. }];
  94. }];
  95. }
  96. return _exerciseSettingHeaderView;
  97. }
  98. @end