// // RQFreeTryViewController.m // SDJK // // Created by 张嵘 on 2022/6/28. // #import "RQFreeTryViewController.h" @interface RQFreeTryViewController () /// viewModel @property (nonatomic, readonly, strong) RQFreeTryViewModel *viewModel; @property (nonatomic, readwrite, strong) RQFreeTryBottomView *freeTryBottomView; @end @implementation RQFreeTryViewController @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; self.tableView.backgroundColor = UIColor.clearColor; [self.view addSubview:self.freeTryBottomView]; [self.view sendSubviewToBack:self.freeTryBottomView]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self.freeTryBottomView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.view); make.bottom.mas_equalTo(self.view.mas_bottom).mas_offset(0.f); make.size.mas_equalTo(CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(294.f))); }]; // 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)); } #pragma mark - OverrideMethods - (UIEdgeInsets)contentInset { return UIEdgeInsetsMake(RQ_APPLICATION_TOP_BAR_HEIGHT, 0, 0, 0); } - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath { RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section]; RQCommonItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row]; return [NSClassFromString(itemViewModel.itemClassName) cellWithTableView:tableView]; } - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { [cell bindViewModel:object]; } #pragma mark - LazyLoad - (RQFreeTryBottomView *)freeTryBottomView { if (!_freeTryBottomView) { _freeTryBottomView = [RQFreeTryBottomView freeTryBottomView]; } return _freeTryBottomView; } @end