RQFreeTryViewController.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // RQFreeTryViewController.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2022/6/28.
  6. //
  7. #import "RQFreeTryViewController.h"
  8. @interface RQFreeTryViewController ()
  9. /// viewModel
  10. @property (nonatomic, readonly, strong) RQFreeTryViewModel *viewModel;
  11. @property (nonatomic, readwrite, strong) RQFreeTryBottomView *freeTryBottomView;
  12. @end
  13. @implementation RQFreeTryViewController
  14. @dynamic viewModel;
  15. #pragma mark - SystemMethod
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. self.tableView.backgroundColor = UIColor.clearColor;
  19. [self.view addSubview:self.freeTryBottomView];
  20. [self.view sendSubviewToBack:self.freeTryBottomView];
  21. }
  22. - (void)viewDidLayoutSubviews {
  23. [super viewDidLayoutSubviews];
  24. [self.freeTryBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.centerX.mas_equalTo(self.view);
  26. make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(0.f);
  27. make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(294.f)));
  28. }];
  29. // self.freeTryBottomView.frame = CGRectMake(0, RQ_SCREEN_HEIGHT - RQ_FIT_HORIZONTAL(294.f) - RQ_APPLICATION_TOP_BAR_HEIGHT, RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(294.f));
  30. }
  31. #pragma mark - OverrideMethods
  32. - (UIEdgeInsets)contentInset {
  33. return UIEdgeInsetsMake(RQ_APPLICATION_TOP_BAR_HEIGHT, 0, 0, 0);
  34. }
  35. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  36. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  37. RQCommonItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  38. return [NSClassFromString(itemViewModel.itemClassName) cellWithTableView:tableView];
  39. }
  40. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  41. [cell bindViewModel:object];
  42. }
  43. #pragma mark - LazyLoad
  44. - (RQFreeTryBottomView *)freeTryBottomView {
  45. if (!_freeTryBottomView) {
  46. _freeTryBottomView = [RQFreeTryBottomView freeTryBottomView];
  47. }
  48. return _freeTryBottomView;
  49. }
  50. @end