123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // RQSimulationTestTopicsViewController.m
- // SDJK
- //
- // Created by 张嵘 on 2021/8/6.
- //
- #import "RQSimulationTestTopicsViewController.h"
- @interface RQSimulationTestTopicsViewController ()
- // viewModel
- @property (nonatomic, readwrite, strong) RQSimulationTestTopicsViewModel *viewModel;
- @property (strong, readwrite, nonatomic) RQSimulationTestTopicsHeaderView *simulationTestTopicsHeaderView;
- @property (nonatomic, readwrite, strong) UIButton *backBtn;
- @end
- @implementation RQSimulationTestTopicsViewController
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- /// 初始化
- [self rq_setup];
- }
- - (void)viewDidLayoutSubviews {
- [super viewDidLayoutSubviews];
- self.simulationTestTopicsHeaderView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, RQSimulationTestTopicsViewHeight - 20 + RQ_APPLICATION_STATUS_BAR_HEIGHT);
- self.backBtn.frame = CGRectMake(0, - (RQSimulationTestTopicsViewHeight - 20 + RQ_APPLICATION_STATUS_BAR_HEIGHT - 82) + RQ_APPLICATION_STATUS_BAR_HEIGHT, 44, 44);
- }
- #pragma mark - PrivateMethods
- - (void)rq_setup {
- self.tableView.backgroundColor = UIColor.clearColor;
- [self.view addSubview:self.simulationTestTopicsHeaderView];
- [self.view sendSubviewToBack:self.simulationTestTopicsHeaderView];
- [self.tableView addSubview:self.backBtn];
- }
- #pragma mark - OverrideMethods
- /// 配置tableView的区域
- - (UIEdgeInsets)contentInset {
- return UIEdgeInsetsMake(RQSimulationTestTopicsViewHeight - 20 + RQ_APPLICATION_STATUS_BAR_HEIGHT - 82, 0, 0, 0);
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
- RQSimulationTestTopicsCell *cell = [RQSimulationTestTopicsCell cellWithTableView:tableView];
- return cell;
- }
- - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
- RQSimulationTestTopicsCell *simulationTestTopicsCell = (RQSimulationTestTopicsCell *)cell;
- [simulationTestTopicsCell bindViewModel:object];
- }
- #pragma mark - LazyLoad
- - (RQSimulationTestTopicsHeaderView *)simulationTestTopicsHeaderView {
- if (!_simulationTestTopicsHeaderView) {
- _simulationTestTopicsHeaderView = [RQSimulationTestTopicsHeaderView simulationTestTopicsHeaderView];
- }
- return _simulationTestTopicsHeaderView;
- }
- - (UIButton *)backBtn {
- if (!_backBtn) {
- @weakify(self);
- _backBtn = [UIButton buttonWithType:UIButtonTypeSystem];
- [_backBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
- @strongify(self);
- [self.viewModel.services popViewModelAnimated:YES];
- }];
- }
- return _backBtn;
- }
- @end
|