12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // RQTestQuestionsViewController.m
- // SDJK
- //
- // Created by 张嵘 on 2021/8/12.
- //
- #import "RQTestQuestionsViewController.h"
- @interface RQTestQuestionsViewController ()
- /// viewModel
- @property (nonatomic, readonly, strong) RQTestQuestionsViewModel *viewModel;
- @end
- @implementation RQTestQuestionsViewController
- @dynamic viewModel;
- #pragma mark - SystemMethod
- - (void)viewDidLoad {
- [super viewDidLoad];
- /// 初始化
- [self rq_setup];
- }
- - (void)dealloc {
-
- }
- #pragma mark - PrivateMethods
- /// 初始化
- - (void)rq_setup {
- [RQ_MUSIC_MANAGER rq_cancelStreamer];
- self.tableView.backgroundColor = RQ_MAIN_BACKGROUNDCOLOR;
- RQ_Exercise_Module.currrentExerciseModel = self.viewModel.exerciseModel;
- @weakify(self)
- [[[RQNotificationCenter rac_addObserverForName:RQQuestionReloadNotification object:nil] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNotification * _Nullable note) {
- @strongify(self)
- RQExerciseModel *exerciseModel = note.object[RQQuestionReloadExerciseModelKey];
- if (self.viewModel.exerciseModel.issue == exerciseModel.issue) {
- self.viewModel.exerciseModel = exerciseModel;
- [self reloadData];
- }
- }];
-
- [[[RACObserve(RQ_Exercise_Module, exerciseFontSize) distinctUntilChanged] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(id _Nullable x) {
- @strongify(self)
- [self.tableView reloadData];
- }];
-
-
- }
- - (void)questionReload:(NSNotification *)note {
-
- }
- #pragma mark - OverrideMethods
- /// 配置tableView的区域
- - (UIEdgeInsets)contentInset {
- return UIEdgeInsetsMake(0, 0, RQ_APPLICATION_TOP_BAR_HEIGHT + RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT + (8.f + RQ_FIT_HORIZONTAL(54.f) + 8.f + 50.f + 8.f) + 49, 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];
- }
- @end
|