// // ExamStatisticsViewModel.m // LN_School // // Created by 张嵘 on 2019/7/29. // Copyright © 2019 Danson. All rights reserved. // #import "ExamStatisticsViewModel.h" #import "ExamStatisticsSubViewController.h" #import "ExamStatisticsModel.h" @implementation ExamStatisticsViewModel - (CGSize)titleSize { return CGSizeMake(hd_deviceWidth, 44); } - (BOOL)headerStop { return YES; } - (NSMutableArray *)titles { return @[@"科目一",@"科目二",@"科目三",@"科目四"].mutableCopy; } - (NSMutableArray *)controllers { if (!_controllers) { NSMutableArray *result = @[].mutableCopy; //仅测试,所以放入同一类型VC for (int i = 0; i < self.titles.count; i ++) { ExamStatisticsSubViewController *vc = [ExamStatisticsSubViewController new]; vc.subViewControllerSecArr = @[[self makeSecTwoModel]].mutableCopy; [result addObject:vc]; } _controllers = result; } return _controllers; } - (HDSectionModel*)makeSecZeroModel { //该段layout HDYogaFlowLayout *layout = [HDYogaFlowLayout new]; layout.headerSize = CGSizeMake(kScreenWidth, kScreenWidth * 0.25); //该段的所有数据封装 HDSectionModel *secModel = [HDSectionModel new]; secModel.sectionHeaderClassStr = @"TrainSummaryHeaderView"; secModel.layout = layout; return secModel; } - (HDSectionModel*)makeSecTwoModel { NSMutableArray *cellModelArr = @[].mutableCopy; NSInteger cellCount = 15; for (int i =0; i < cellCount; i++) { HDCellModel *model = [HDCellModel new]; ExamStatisticsModel *examStatisticsModel = [ExamStatisticsModel new]; examStatisticsModel.time = @"2019-08-08"; examStatisticsModel.carType = @"C1"; examStatisticsModel.examNum = @"1"; examStatisticsModel.passNum = @"10"; examStatisticsModel.passPercent = @"10%"; model.orgData = examStatisticsModel; model.cellSize = CGSizeMake(kScreenWidth, 141); model.cellClassStr = @"ExamStatisticsCell"; [cellModelArr addObject:model]; } //该段layout HDYogaFlowLayout *layout = [HDYogaFlowLayout new];//isUseSystemFlowLayout为YES时只支持HDBaseLayout layout.secInset = UIEdgeInsetsMake(10, 0, 0, 0); layout.justify = YGJustifySpaceBetween; layout.verticalGap = 10; layout.footerSize = CGSizeMake(kScreenWidth, 10); //该段的所有数据封装 HDSectionModel *secModel = [HDSectionModel new]; secModel.sectionHeaderClassStr = @"HomePageNumHeaderView"; secModel.sectionFooterClassStr = @"CommonSecFooterView"; secModel.headerTopStopType = HDHeaderStopOnTopTypeNormal; secModel.isNeedAutoCountCellHW = NO; secModel.sectionDataArr = cellModelArr; secModel.layout = layout; return secModel; } @end