|
@@ -0,0 +1,425 @@
|
|
|
|
+//
|
|
|
|
+// NYFailSpecialExerciseDetailsCell01.m
|
|
|
|
+// jiaPei
|
|
|
|
+//
|
|
|
|
+// Created by Ning.ge on 2024/12/17.
|
|
|
|
+// Copyright © 2024 JCZ. All rights reserved.
|
|
|
|
+//
|
|
|
|
+
|
|
|
|
+#import "NYFailSpecialExerciseDetailsCell01.h"
|
|
|
|
+
|
|
|
|
+@interface NYFailSpecialExerciseDetailsCell01 ()
|
|
|
|
+
|
|
|
|
+@property (nonatomic, readwrite, strong) NYFailSpecialExerciseDetailItemModel *viewModel;
|
|
|
|
+
|
|
|
|
+@end
|
|
|
|
+
|
|
|
|
+@implementation NYFailSpecialExerciseDetailsCell01
|
|
|
|
+
|
|
|
|
+#pragma mark - PublicMethods
|
|
|
|
++ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
+ static NSString *ID = @"NYFailSpecialExerciseDetailsCell01";
|
|
|
|
+ [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
|
|
|
|
+ NYFailSpecialExerciseDetailsCell01 *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
|
|
|
|
+ if (!cell) cell = [self rq_viewFromXib];
|
|
|
|
+ return cell;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)bindViewModel:(NYFailSpecialExerciseDetailItemModel *)viewModel {
|
|
|
|
+ @weakify(self)
|
|
|
|
+ self.viewModel = viewModel;
|
|
|
|
+ self.scoreStr_label.text = viewModel.dataModel.title;
|
|
|
|
+ self.vw_left_label.text = viewModel.itemPointTitle;
|
|
|
|
+ __block CGFloat yOffset = 0; // 初始偏移量
|
|
|
|
+ __block CGFloat cellHeight = 35.f; // 每个 Cell 的高度(根据实际设计调整)
|
|
|
|
+ int bi = 0;
|
|
|
|
+ CGFloat imgW = (RQ_SCREEN_WIDTH-22*2);
|
|
|
|
+ self.itop_view.hidden = YES;
|
|
|
|
+ if(viewModel.dataModel.con.count>0){//手势
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.con.count; i++) {
|
|
|
|
+ NYFailItemPointDataCon *con = viewModel.dataModel.con[i];
|
|
|
|
+ NSString *img_url = con.image;
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+i];
|
|
|
|
+ __block CGSize imageSize = CGSizeMake(imgW,cellHeight);
|
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
+ // 处理耗时操作的代码块...
|
|
|
|
+ imageSize = [UIImage getImageSizeWithURL:img_url];
|
|
|
|
+ //通知主线程刷新
|
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
+ //回调或者说是通知主线程刷新,
|
|
|
|
+ if (imageSize.width == 0 || imageSize.height == 0) {
|
|
|
|
+ cellHeight = imgW * (175.f / 345.f);
|
|
|
|
+ } else {
|
|
|
|
+ cellHeight = imgW * (imageSize.height / imageSize.width);
|
|
|
|
+ }
|
|
|
|
+ image_view.frame = CGRectMake(0, yOffset, imgW, cellHeight);
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ yOffset += cellHeight+10*(i+1);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ [image_view sd_setImageWithURL:[NSURL URLWithString:img_url]];
|
|
|
|
+ image_view.hidden = NO;
|
|
|
|
+ bi = i+1;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=bi; ci<10; ci++) {
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+ci];
|
|
|
|
+ image_view.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(viewModel.dataModel.tagquestions.count>0){
|
|
|
|
+ self.vw_left_view.hidden = YES;
|
|
|
|
+ self.itop_view.hidden = NO;
|
|
|
|
+ self.itop_view.frame = CGRectMake(0, 0, imgW, viewModel.dataModel.iviewH);
|
|
|
|
+ CGFloat tagitop_yOffset = 10; // 初始偏移量
|
|
|
|
+ CGFloat tagtop_cellHeight = 35.f; // 每个 Cell 的高度(根据实际设计调整)
|
|
|
|
+ int tagitop_bi = 0;
|
|
|
|
+ int tagitop_bicc = 0;
|
|
|
|
+ int tagitop_biccc = 0;
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.tagquestions.count; i++) {
|
|
|
|
+ NYFailItemPointDataQuestions *tag = viewModel.dataModel.tagquestions[i];
|
|
|
|
+ NSString *tag_str = tag.tag;
|
|
|
|
+ // 从 XIB 加载 NYFailItemPointCellView
|
|
|
|
+ UIButton *btn = [self.itop_view viewWithTag:29+i];
|
|
|
|
+ btn.hidden = NO;
|
|
|
|
+ btn.frame = CGRectMake(10, tagitop_yOffset+10*i, 150.f, 25.f);
|
|
|
|
+ [btn setTitleNormal:tag_str];
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ tagitop_yOffset += 25.f+10*i;
|
|
|
|
+ for (int z= 0; z<tag.tagCon.count; z++) {
|
|
|
|
+ NYFailItemPointDataQuesTexts *textItem = tag.tagCon[z];
|
|
|
|
+ NSString *title_str = textItem.subTitle;
|
|
|
|
+ // 从 XIB 加载 NYFailItemPointCellView
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+z+tagitop_bicc];
|
|
|
|
+ cellView.hidden = NO;
|
|
|
|
+ CGSize str_size = [title_str rq_sizeWithFont:cellView.content_label.font limitWidth:cellView.content_label.width];
|
|
|
|
+ if(str_size.height>tagtop_cellHeight){
|
|
|
|
+ tagtop_cellHeight = str_size.height + 12.f;
|
|
|
|
+ }
|
|
|
|
+ cellView.frame = CGRectMake(0, tagitop_yOffset, RQ_SCREEN_WIDTH-22*2, tagtop_cellHeight);
|
|
|
|
+ cellView.content_label.attributedText = [self getAttributedString:title_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ tagitop_yOffset += tagtop_cellHeight;
|
|
|
|
+
|
|
|
|
+ if(textItem.quesItem.count>0){
|
|
|
|
+ CGFloat ab_H = 20.f;
|
|
|
|
+ for (int t= 0; t<textItem.quesItem.count; t++) {
|
|
|
|
+ NSString *item_str = textItem.quesItem[t];
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+t+tagitop_biccc];
|
|
|
|
+ label.hidden = NO;
|
|
|
|
+ label.attributedText = [self getAttributedString:item_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ label.frame = CGRectMake(10, tagitop_yOffset, RQ_SCREEN_WIDTH-22*2, ab_H);
|
|
|
|
+ tagitop_yOffset += ab_H;
|
|
|
|
+ }
|
|
|
|
+ tagitop_biccc += textItem.quesItem.count;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tagitop_bicc += tag.tagCon.count;
|
|
|
|
+ tagitop_bi =i+1;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=tagitop_bi; ci<10; ci++) {
|
|
|
|
+ UIButton *btn = [self.itop_view viewWithTag:29+ci];
|
|
|
|
+ btn.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=tagitop_biccc; ci<10; ci++) {
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+ci];
|
|
|
|
+ label.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=tagitop_bicc; ci<10; ci++) {
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+ci];
|
|
|
|
+ cellView.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(viewModel.dataModel.iquestions.count>0){
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.iquestions.count; i++) {
|
|
|
|
+ NYFailItemPointDataQuesImage *img = viewModel.dataModel.iquestions[i];
|
|
|
|
+ NSString *img_url = img.image;
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+i];
|
|
|
|
+ __block CGSize imageSize = CGSizeMake(imgW,cellHeight);
|
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
+ // 处理耗时操作的代码块...
|
|
|
|
+ imageSize = [UIImage getImageSizeWithURL:img_url];
|
|
|
|
+ //通知主线程刷新
|
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
+ //回调或者说是通知主线程刷新,
|
|
|
|
+ if (imageSize.width == 0 || imageSize.height == 0) {
|
|
|
|
+ cellHeight = imgW * (175.f / 345.f);
|
|
|
|
+ } else {
|
|
|
|
+ cellHeight = imgW * (imageSize.height / imageSize.width);
|
|
|
|
+ }
|
|
|
|
+ image_view.frame = CGRectMake(0, yOffset, imgW, cellHeight);
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ yOffset += cellHeight+10*(i+1);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ [image_view sd_setImageWithURL:[NSURL URLWithString:img_url]];
|
|
|
|
+ image_view.hidden = NO;
|
|
|
|
+ bi = i+1;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=bi; ci<10; ci++) {
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+ci];
|
|
|
|
+ image_view.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(viewModel.dataModel.fquestions.count>0){
|
|
|
|
+ self.vw_left_view.hidden = YES;
|
|
|
|
+ self.itop_view.hidden = NO;
|
|
|
|
+ self.itop_view.frame = CGRectMake(0, 0, imgW, viewModel.dataModel.iviewH);
|
|
|
|
+ yOffset = CGRectGetMaxY(self.itop_view.frame) +10.f;
|
|
|
|
+ CGFloat fitop_yOffset = 0; // 初始偏移量
|
|
|
|
+ CGFloat fitop_cellHeight = 35.f; // 每个 Cell 的高度(根据实际设计调整)
|
|
|
|
+ int fitop_bi = 0;
|
|
|
|
+ int fitop_bicc = 0;
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.fquestions.count; i++) {
|
|
|
|
+ NYFailItemPointDataQuesTexts *textItem = viewModel.dataModel.fquestions[i];
|
|
|
|
+ NSString *title_str = textItem.subTitle;
|
|
|
|
+ // 从 XIB 加载 NYFailItemPointCellView
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+i];
|
|
|
|
+ cellView.hidden = NO;
|
|
|
|
+ CGSize str_size = [title_str rq_sizeWithFont:cellView.content_label.font limitWidth:cellView.content_label.width];
|
|
|
|
+ if(str_size.height>fitop_cellHeight){
|
|
|
|
+ fitop_cellHeight = str_size.height + 12.f;
|
|
|
|
+ }
|
|
|
|
+ cellView.frame = CGRectMake(0, fitop_yOffset, RQ_SCREEN_WIDTH-22*2, fitop_cellHeight);
|
|
|
|
+ cellView.content_label.attributedText = [self getAttributedString:title_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ fitop_yOffset += fitop_cellHeight;
|
|
|
|
+ fitop_bi = i+1;
|
|
|
|
+ if(textItem.quesItem.count>0){
|
|
|
|
+ CGFloat ab_H = 20.f;
|
|
|
|
+ for (int z= 0; z<textItem.quesItem.count; z++) {
|
|
|
|
+ NSString *item_str = textItem.quesItem[z];
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+z+fitop_bicc];
|
|
|
|
+ label.hidden = NO;
|
|
|
|
+ label.attributedText = [self getAttributedString:item_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ label.frame = CGRectMake(10, fitop_yOffset, RQ_SCREEN_WIDTH-22*2, ab_H);
|
|
|
|
+ fitop_yOffset += ab_H;
|
|
|
|
+ }
|
|
|
|
+ fitop_bicc += textItem.quesItem.count;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (int ci=fitop_bicc; ci<10; ci++) {
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+ci];
|
|
|
|
+ label.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=fitop_bi; ci<10; ci++) {
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+ci];
|
|
|
|
+ cellView.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(viewModel.dataModel.questions.quesTexts.count>0){
|
|
|
|
+ self.itop_view.hidden = NO;
|
|
|
|
+ self.itop_view.frame = CGRectMake(0, 0, imgW, viewModel.dataModel.iviewH);
|
|
|
|
+ yOffset = CGRectGetMaxY(self.itop_view.frame) +10.f;
|
|
|
|
+ CGFloat itop_yOffset = 0; // 初始偏移量
|
|
|
|
+ CGFloat itop_cellHeight = 35.f; // 每个 Cell 的高度(根据实际设计调整)
|
|
|
|
+ int itop_bi = 0;
|
|
|
|
+ int itop_bicc = 0;
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.questions.quesTexts.count; i++) {
|
|
|
|
+ NYFailItemPointDataQuesTexts *textItem = viewModel.dataModel.questions.quesTexts[i];
|
|
|
|
+ NSString *title_str = textItem.subTitle;
|
|
|
|
+ // 从 XIB 加载 NYFailItemPointCellView
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+i];
|
|
|
|
+ cellView.hidden = NO;
|
|
|
|
+ CGSize str_size = [title_str rq_sizeWithFont:cellView.content_label.font limitWidth:cellView.content_label.width];
|
|
|
|
+ if(str_size.height>itop_cellHeight){
|
|
|
|
+ itop_cellHeight = str_size.height + 12.f;
|
|
|
|
+ }
|
|
|
|
+ cellView.frame = CGRectMake(0, itop_yOffset, RQ_SCREEN_WIDTH-22*2, itop_cellHeight);
|
|
|
|
+ cellView.content_label.attributedText = [self getAttributedString:title_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ itop_yOffset += itop_cellHeight;
|
|
|
|
+ itop_bi = i+1;
|
|
|
|
+ if(textItem.quesItem.count>0){
|
|
|
|
+ CGFloat ab_H = 20.f;
|
|
|
|
+ for (int z= 0; z<textItem.quesItem.count; z++) {
|
|
|
|
+ NSString *item_str = textItem.quesItem[z];
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+z+itop_bicc];
|
|
|
|
+ label.hidden = NO;
|
|
|
|
+ label.attributedText = [self getAttributedString:item_str color:UIColorHex(0xFF6714)];
|
|
|
|
+ label.frame = CGRectMake(10, itop_yOffset, RQ_SCREEN_WIDTH-22*2, ab_H);
|
|
|
|
+ itop_yOffset += ab_H;
|
|
|
|
+ }
|
|
|
|
+ itop_bicc += textItem.quesItem.count;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (int ci=itop_bicc; ci<10; ci++) {
|
|
|
|
+ UILabel *label = [self.itop_view viewWithTag:59+ci];
|
|
|
|
+ label.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ for (int ci=itop_bi; ci<10; ci++) {
|
|
|
|
+ NYFailItemPointCellView *cellView = [self.itop_view viewWithTag:19+ci];
|
|
|
|
+ cellView.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (int i= 0; i<viewModel.dataModel.questions.images.count; i++) {
|
|
|
|
+ NSString *img_url = viewModel.dataModel.questions.images[i];
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+i];
|
|
|
|
+ __block CGSize imageSize = CGSizeMake(imgW,cellHeight);
|
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
|
+ @strongify(self)
|
|
|
|
+ // 处理耗时操作的代码块...
|
|
|
|
+ imageSize = [UIImage getImageSizeWithURL:img_url];
|
|
|
|
+ //通知主线程刷新
|
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
+ //回调或者说是通知主线程刷新,
|
|
|
|
+ if (imageSize.width == 0 || imageSize.height == 0) {
|
|
|
|
+ cellHeight = imgW * (175.f / 345.f);
|
|
|
|
+ } else {
|
|
|
|
+ cellHeight = imgW * (imageSize.height / imageSize.width);
|
|
|
|
+ }
|
|
|
|
+ image_view.frame = CGRectMake(0, yOffset, imgW, cellHeight);
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ yOffset += cellHeight+10*(i+1);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ [image_view sd_setImageWithURL:[NSURL URLWithString:img_url]];
|
|
|
|
+ image_view.hidden = NO;
|
|
|
|
+ bi = i+1;
|
|
|
|
+ for (int ci=bi; ci<10; ci++) {
|
|
|
|
+ UIImageView *image_view = [self.item_view viewWithTag:99+ci];
|
|
|
|
+ image_view.hidden = YES;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+- (NSMutableAttributedString*)getAttributedString:(NSString *)str color:(UIColor*)color {
|
|
|
|
+ // 使用正则表达式匹配所有 [ ] 中的内容
|
|
|
|
+ NSError *error = nil;
|
|
|
|
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\\[([^\\]]+)\\]" options:0 error:&error];
|
|
|
|
+
|
|
|
|
+ if (error) {
|
|
|
|
+ NSLog(@"正则表达式错误: %@", error.localizedDescription);
|
|
|
|
+ return [[NSMutableAttributedString alloc] initWithString:str];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 用于存储需要替换的内容和范围
|
|
|
|
+ NSMutableArray<NSDictionary *> *replacements = [NSMutableArray array];
|
|
|
|
+
|
|
|
|
+ // 匹配 [ ] 中的内容
|
|
|
|
+ NSArray<NSTextCheckingResult *> *matches = [regex matchesInString:str options:0 range:NSMakeRange(0, str.length)];
|
|
|
|
+
|
|
|
|
+ for (NSTextCheckingResult *match in matches) {
|
|
|
|
+ if (match.numberOfRanges > 1) {
|
|
|
|
+ // 提取 [ ] 内部的内容
|
|
|
|
+ NSRange innerRange = [match rangeAtIndex:1];
|
|
|
|
+ NSString *matchedText = [str substringWithRange:innerRange];
|
|
|
|
+
|
|
|
|
+ // 保存替换内容和范围
|
|
|
|
+ [replacements addObject:@{
|
|
|
|
+ @"text": matchedText,
|
|
|
|
+ @"range": [NSValue valueWithRange:match.range]
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 创建可变字符串以进行替换
|
|
|
|
+ NSMutableString *updatedString = [NSMutableString stringWithString:str];
|
|
|
|
+ NSMutableArray<NSValue *> *highlightedRanges = [NSMutableArray array];
|
|
|
|
+ NSInteger offset = 0;
|
|
|
|
+
|
|
|
|
+ for (NSDictionary *replacement in replacements) {
|
|
|
|
+ NSString *text = replacement[@"text"];
|
|
|
|
+ NSRange range = [replacement[@"range"] rangeValue];
|
|
|
|
+
|
|
|
|
+ // 调整范围以匹配当前字符串的变化
|
|
|
|
+ range.location += offset;
|
|
|
|
+
|
|
|
|
+ // 替换 [ ] 为其内部内容
|
|
|
|
+ [updatedString replaceCharactersInRange:range withString:text];
|
|
|
|
+
|
|
|
|
+ // 记录调整后的范围
|
|
|
|
+ NSRange adjustedRange = NSMakeRange(range.location, text.length);
|
|
|
|
+ [highlightedRanges addObject:[NSValue valueWithRange:adjustedRange]];
|
|
|
|
+
|
|
|
|
+ // 更新偏移量
|
|
|
|
+ offset += (text.length - range.length);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 创建 NSMutableAttributedString
|
|
|
|
+ NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:updatedString];
|
|
|
|
+
|
|
|
|
+ // 设置高亮颜色(黄色)
|
|
|
|
+ for (NSValue *rangeValue in highlightedRanges) {
|
|
|
|
+ [attributedString addAttribute:NSForegroundColorAttributeName value:color range:rangeValue.rangeValue];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return attributedString;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+- (IBAction)submit_clickdo:(UIButton *)sender {
|
|
|
|
+ NSString *questionIds = self.viewModel.dataModel.questionIds;
|
|
|
|
+ NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithExerciseType:RQExerciseType_Error_Special_List questionIds:questionIds].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
|
|
|
|
+ return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
|
|
|
|
+ }].toArray;
|
|
|
|
+ RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
|
|
|
|
+ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
|
|
|
|
+ RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
|
|
|
|
+ RQHomeSubPageTypeKey : @(RQHomeSubPageType_SequentialPractice),
|
|
|
|
+ RQViewModelIDKey : @"标题",
|
|
|
|
+ RQExerciseTypeKey : @(RQExerciseType_Error_Special_List),
|
|
|
|
+ RQViewModelUtilKey : arr,
|
|
|
|
+ }];
|
|
|
|
+ [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#pragma mark - SystemMethods
|
|
|
|
+- (void)awakeFromNib {
|
|
|
|
+ [super awakeFromNib];
|
|
|
|
+ [self initTbList_view];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)initTbList_view{
|
|
|
|
+ UIView *itop_view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH-22*2, 20)];
|
|
|
|
+ itop_view.backgroundColor = UIColor.whiteColor;
|
|
|
|
+ itop_view.layer.cornerRadius = 5.f;
|
|
|
|
+ itop_view.layer.masksToBounds = YES;
|
|
|
|
+ itop_view.hidden = YES;
|
|
|
|
+ [self.item_view addSubview:itop_view];
|
|
|
|
+ self.itop_view = itop_view;
|
|
|
|
+
|
|
|
|
+ //10 + 10
|
|
|
|
+ for (int i= 0; i<10; i++) {
|
|
|
|
+ UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
+ [btn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
|
|
|
|
+ btn.titleLabel.font = [UIFont systemFontOfSize:15.f];
|
|
|
|
+ btn.backgroundColor = UIColorHex(0xC1D7FF);
|
|
|
|
+ btn.layer.cornerRadius = 5.f;
|
|
|
|
+ btn.layer.masksToBounds = YES;
|
|
|
|
+ btn.tag = 29+i;
|
|
|
|
+ btn.hidden = YES;
|
|
|
|
+ [self.itop_view addSubview:btn];
|
|
|
|
+ }
|
|
|
|
+ for (int i= 0; i<10; i++) {
|
|
|
|
+ NYFailItemPointCellView *cellView = [[NYFailItemPointCellView alloc] initWithFrame:CGRectMake(0, 0, RQ_SCREEN_WIDTH-22*2, 0)];
|
|
|
|
+ cellView.tag = 19+i;
|
|
|
|
+ cellView.hidden = YES;
|
|
|
|
+ [self.itop_view addSubview:cellView];
|
|
|
|
+ }
|
|
|
|
+ for (int i= 0; i<10; i++) {
|
|
|
|
+ UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, RQ_SCREEN_WIDTH-22*2, 0)];
|
|
|
|
+ label.font = [UIFont systemFontOfSize:11.f];
|
|
|
|
+ label.textColor = UIColorHex(0x5C6066);
|
|
|
|
+ label.tag = 59+i;
|
|
|
|
+ label.hidden = YES;
|
|
|
|
+ [self.itop_view addSubview:label];
|
|
|
|
+ }
|
|
|
|
+ // 初始化按钮
|
|
|
|
+ CGFloat yOffset = 0; // 初始偏移量
|
|
|
|
+ CGFloat cellHeight = 1.f; // 每个 Cell 的高度(根据实际设计调整)
|
|
|
|
+ for (int i= 0; i<10; i++) {
|
|
|
|
+ UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, yOffset, RQ_SCREEN_WIDTH-22*2, cellHeight)];
|
|
|
|
+ imageView.tag = 99+i;
|
|
|
|
+ imageView.hidden = YES;
|
|
|
|
+ // 添加到 tbList_view
|
|
|
|
+ [self.item_view addSubview:imageView];
|
|
|
|
+ // 调整偏移量
|
|
|
|
+ yOffset += cellHeight;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@end
|