// // DetailContentView.m // smartRhino // // Created by tederen on 2019/10/29. // Copyright © 2019 tederen. All rights reserved. // #import "DetailContentView.h" #import "DocumentModel.h" @interface DetailContentView () @property (nonatomic, strong) NSArray * sourceData; @property (nonatomic, strong) UILabel *textLabel; @end @implementation DetailContentView - (instancetype)init{ self = [super init]; if (self){ } return self; } - (void)loadContentModel:(DocumentModel *)model{ CGFloat topMargin = 14.f; CGFloat leftMargin = 21.f; DocumentModel *model1 = [[DocumentModel alloc]init]; model1.content = @"今年以来我国就业形势总体稳定,劳动力市场供求基本平衡。国家统计局数据显示前三季度,全国城镇新增就业1097万人,完成全年目标任务的99.7%。 9月份,全国城镇调查失业率为5.2%,低于5.5%的预期控制目标。"; model1.contentType = 1; DocumentModel *model2 = [[DocumentModel alloc]init]; model2.content = @"高校毕业生就业稳中向好。人力资源和社会保障部就业促进司司长张莹说,高校毕业生目前就业水平与往年基本持平,1至9月份就业困难人员实现就业133万人已经完成全年130万人的目标任务有突破。今年以来我国就业形势总体稳定,劳动力市场供求基本平衡。国家统计局数据显示前三季度,全国城镇新增就业1097万人, 完成全年目标任务的99.7%。 9月份,全国城镇调查失业率为5.2%,低于5.5%的预期控制国家统计局目标。"; model2.contentType = 1; DocumentModel *model3 = [[DocumentModel alloc]init]; model3.content = @"应届毕业生就业稳中向好。人力资源 和社会保障部就业促进司司长张莹说,高 校毕业生目前就业水平与往年基本持平, 1至9月份就困难人员实现就业133万人已经完成全年130万人的目标任务平衡发,市场供求基本平衡。国家统计局数据显示前三季度,全国城镇新增就业1097万人,完成全年目标任务的99.7%。9月份,全国城镇调查失业率为5.2%,低于5.5%的预期控制国家统计局目标。"; model3.contentType = 1; self.sourceData = @[model1,model2,model3]; for (int i = 0; i< _sourceData.count; i++) { DocumentModel *model = _sourceData[i]; if (model.contentType == 1) { // 文本 UILabel *textlabel = [[UILabel alloc]init]; textlabel.font = [UIFont systemFontOfSize:18.5]; textlabel.text = model.content; textlabel.textColor = UIColorHex(0A0A0A); textlabel.numberOfLines = 0; [self addSubview:textlabel]; [ZYCTool setLabel:textlabel withSpace:13.f withFont:[UIFont systemFontOfSize:19] setLineSpace:2 setTextSpace:0.8]; CGSize titleSize = [textlabel sizeThatFits:CGSizeMake(kGXScreenWidth-21*2, MAXFLOAT)]; textlabel.frame = CGRectMake(leftMargin, topMargin, titleSize.width, titleSize.height); topMargin += titleSize.height; if (i == _sourceData.count -1 ){ }else{ topMargin += 35.f; } }else{ // 图片 } } CGRect frame = self.frame; frame.size.height = topMargin; self.frame = frame; } @end