// // SPSBExplainViewController.m // 我的社保 // // Created by shanp on 2021/5/13. // #import "SPSBExplainViewController.h" #import "SPSBUIGeneralHeader.h" @interface SPSBExplainViewController () @end @implementation SPSBExplainViewController - (void)viewDidLoad { [super viewDidLoad]; [self setupUI]; } #pragma mark - Action #pragma mark - Network Action #pragma mark - UI - (void)setupUI { self.view.backgroundColor = spsb_F5F5F5_color(); SEL action = NSSelectorFromString([NSString stringWithFormat:@"loadViewWithExplainType%ld", (long)_spsb_explainType]); IMP imp = [self methodForSelector:action]; void (*func)(id, SEL) = (void *)imp; func(self, action); } //关于我的社保 - (void)loadViewWithExplainType0 { UIScrollView *scrollView = [UIScrollView convenienceWithBackgroundColor:spsb_FFFFFF_color(1.f)]; [self.view addSubview:scrollView]; [scrollView makeConstraints:^(JXHConstraintMaker *make) { make.edges.equalTo(self.view); }]; NSArray *contentArray = [SPSBAboutAPP componentsSeparatedByString:@"\n"]; UIView *tempView = nil; for (NSInteger i = 0; i < contentArray.count; i ++) { UIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor whiteColor]; [scrollView addSubview:view]; [view makeConstraints:^(JXHConstraintMaker *make) { make.leading.and.trailing.equalTo(0); make.width.equalTo(jxh_screenWidth()); if (tempView) { make.top.equalTo(tempView.bottom).offset(31); } else { make.top.equalTo(31); } }]; UILabel *content = [UILabel convenienceWithFont:spsb_font(15) textColor:spsb_333333_color() limitWidth:jxh_screenWidth() - 56]; [content setAttributedStringWithText:contentArray[i] lineSpacing:9]; [view addSubview:content]; [content makeConstraints:^(JXHConstraintMaker *make) { make.leading.equalTo(28); make.trailing.equalTo(-28); make.top.equalTo(0); make.bottom.equalTo(0); }]; tempView = view; } if (tempView) { [tempView makeConstraints:^(JXHConstraintMaker *make) { make.bottom.equalTo(-20); }]; } } //代理社保、公积金协议 - (void)loadViewWithExplainType1 { UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, jxh_screenWidth(), jxh_screenHeight() - 49)]; scrollView.showsVerticalScrollIndicator = false; [self.view addSubview:scrollView]; NSString *str = SPSBAgencyAgreement; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, jxh_screenWidth() - 30, jxh_screenHeight())]; label.numberOfLines = 0; NSAttributedString *att = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil]; label.attributedText = att; [label sizeToFit]; [scrollView addSubview:label]; scrollView.contentSize = CGSizeMake(jxh_screenWidth(), jxh_viewHeight(label) + 30); } //我的社保协议 - (void)loadViewWithExplainType2 { UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, jxh_screenWidth(), jxh_screenHeight() - 49)]; scrollView.showsVerticalScrollIndicator = false; [self.view addSubview:scrollView]; NSString *str = SPSBAgreement; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, jxh_screenWidth() - 30, jxh_screenHeight())]; label.numberOfLines = 0; NSAttributedString *att = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil]; label.attributedText = att; [label sizeToFit]; [scrollView addSubview:label]; scrollView.contentSize = CGSizeMake(jxh_screenWidth(), jxh_viewHeight(label) + 30); } @end