123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- //
- // NYFailSpecialExerciseDetailItemModel.m
- // jiaPei
- //
- // Created by Ning.ge on 2024/12/12.
- // Copyright © 2024 JCZ. All rights reserved.
- //
- #import "NYFailSpecialExerciseDetailItemModel.h"
- @interface NYFailSpecialExerciseDetailItemModel()
- @end
- @implementation NYFailSpecialExerciseDetailItemModel
- - (instancetype)init {
- if (self = [super init]) {
- self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(160));
- }
- return self;
- }
- - (NSString *)itemClassName {
- if([self.title isEqualToString:@"koufen"]){
- return @"NYFailSpecialExerciseDetailsCell";
- }
- return @"NYFailSpecialExerciseDetailsCell01";
- }
- - (nonnull instancetype)initWithTitle:(nonnull NSString *)title dataModel:(NYFailItemPointDataModel *)dataModel {
- if (self = [self init]) {
- @weakify(self)
- self.title = title;
- self.dataModel = dataModel;
- if(dataModel.showType.intValue == 1){
- CGFloat yOffset = 0; // 初始偏移量
- CGFloat cellHeight = 35.f;
- for (int i= 0; i<dataModel.question_array.count; i++) {
- NSString *title_str = [NSString stringWithFormat:@"%zd.%@",i+1,dataModel.question_array[i]];
- CGSize str_size = [title_str rq_sizeWithFont:[UIFont boldSystemFontOfSize:15.f] limitWidth:RQ_SCREEN_WIDTH-22*2-16];
- if(str_size.height>cellHeight){
- cellHeight = str_size.height + 12.f;
- }
- // 调整偏移量
- yOffset += cellHeight;
- }
- self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(130)+yOffset);
- }else{
- CGFloat itemH = 0.f;
- if(dataModel.imgsH > 0){
- itemH +=dataModel.imgsH;
- }
- if(dataModel.iviewH > 0){
- itemH +=dataModel.iviewH;
- }
- self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(130)+itemH);
- }
- self.operation = ^{
-
- };
- }
- return self;
- }
- @end
|