// // RQWrongAndCollectionVC.m // SDJK // // Created by 张嵘 on 2022/5/23. // #import "RQWrongAndCollectionVC.h" @interface RQWrongAndCollectionVC () /// viewModel @property (nonatomic, readwrite, strong) RQWrongAndCollectionViewModel *viewModel; @property (nonatomic, readwrite, strong) UIImageView *headerImageView; @property (nonatomic, readwrite, strong) UIImageView *footerImageView; @end @implementation RQWrongAndCollectionVC @dynamic viewModel; #pragma mark - SystemMethod - (void)viewDidLoad { [super viewDidLoad]; /// 初始化 [self rq_setup]; } - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; } #pragma mark - PrivateMethods - (void)rq_setup { self.tableView.tableHeaderView = self.headerImageView; self.tableView.tableFooterView = self.footerImageView; } #pragma mark - OverrideMethods - (UIEdgeInsets)contentInset { return UIEdgeInsetsMake(RQ_APPLICATION_TOP_BAR_HEIGHT, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT, 0); } - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath { RQWrongAndCollectionCell *wrongAndCollectionCell = [RQWrongAndCollectionCell cellWithTableView:tableView]; RQSynExerciseCell *synExerciseCell = [RQSynExerciseCell cellWithTableView:tableView]; return (indexPath.row == 2)? synExerciseCell : wrongAndCollectionCell; } - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object { if (indexPath.row == 2) { RQSynExerciseCell *synExerciseCell = (RQSynExerciseCell *)cell; [synExerciseCell bindViewModel:object]; } else { RQWrongAndCollectionCell *wrongAndCollectionCell = (RQWrongAndCollectionCell *)cell; [wrongAndCollectionCell bindViewModel:object]; } } #pragma mark - LazyLoad - (UIImageView *)headerImageView { if (!_headerImageView) { _headerImageView = [[UIImageView alloc] initWithImage:RQImageNamed(@"头部图")]; _headerImageView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(148.f)); } return _headerImageView; } - (UIImageView *)footerImageView { if (!_footerImageView) { _footerImageView = [[UIImageView alloc] initWithImage:RQImageNamed(@"错题收藏底部图")]; _footerImageView.frame = CGRectMake(0, 0, RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(222.f)); } return _footerImageView; } @end