SPSBExplainViewController.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // SPSBExplainViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/13.
  6. //
  7. #import "SPSBExplainViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. @interface SPSBExplainViewController ()
  10. @end
  11. @implementation SPSBExplainViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. [self setupUI];
  15. }
  16. #pragma mark - Action
  17. #pragma mark - Network Action
  18. #pragma mark - UI
  19. - (void)setupUI {
  20. self.view.backgroundColor = spsb_F5F5F5_color();
  21. SEL action = NSSelectorFromString([NSString stringWithFormat:@"loadViewWithExplainType%ld", (long)_spsb_explainType]);
  22. IMP imp = [self methodForSelector:action];
  23. void (*func)(id, SEL) = (void *)imp;
  24. func(self, action);
  25. }
  26. //关于我的社保
  27. - (void)loadViewWithExplainType0 {
  28. UIScrollView *scrollView = [UIScrollView convenienceWithBackgroundColor:spsb_FFFFFF_color(1.f)];
  29. [self.view addSubview:scrollView];
  30. [scrollView makeConstraints:^(JXHConstraintMaker *make) {
  31. make.edges.equalTo(self.view);
  32. }];
  33. NSArray *contentArray = [SPSBAboutAPP componentsSeparatedByString:@"\n"];
  34. UIView *tempView = nil;
  35. for (NSInteger i = 0; i < contentArray.count; i ++) {
  36. UIView *view = [[UIView alloc] init];
  37. view.backgroundColor = [UIColor whiteColor];
  38. [scrollView addSubview:view];
  39. [view makeConstraints:^(JXHConstraintMaker *make) {
  40. make.leading.and.trailing.equalTo(0);
  41. make.width.equalTo(jxh_screenWidth());
  42. if (tempView) {
  43. make.top.equalTo(tempView.bottom).offset(31);
  44. } else {
  45. make.top.equalTo(31);
  46. }
  47. }];
  48. UILabel *content = [UILabel convenienceWithFont:spsb_font(15) textColor:spsb_333333_color() limitWidth:jxh_screenWidth() - 56];
  49. [content setAttributedStringWithText:contentArray[i] lineSpacing:9];
  50. [view addSubview:content];
  51. [content makeConstraints:^(JXHConstraintMaker *make) {
  52. make.leading.equalTo(28);
  53. make.trailing.equalTo(-28);
  54. make.top.equalTo(0);
  55. make.bottom.equalTo(0);
  56. }];
  57. tempView = view;
  58. }
  59. if (tempView) {
  60. [tempView makeConstraints:^(JXHConstraintMaker *make) {
  61. make.bottom.equalTo(-20);
  62. }];
  63. }
  64. }
  65. //代理社保、公积金协议
  66. - (void)loadViewWithExplainType1 {
  67. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, jxh_screenWidth(), jxh_screenHeight() - 49)];
  68. scrollView.showsVerticalScrollIndicator = false;
  69. [self.view addSubview:scrollView];
  70. NSString *str = SPSBAgencyAgreement;
  71. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, jxh_screenWidth() - 30, jxh_screenHeight())];
  72. label.numberOfLines = 0;
  73. NSAttributedString *att = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
  74. label.attributedText = att;
  75. [label sizeToFit];
  76. [scrollView addSubview:label];
  77. scrollView.contentSize = CGSizeMake(jxh_screenWidth(), jxh_viewHeight(label) + 30);
  78. }
  79. //我的社保协议
  80. - (void)loadViewWithExplainType2 {
  81. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, jxh_screenWidth(), jxh_screenHeight() - 49)];
  82. scrollView.showsVerticalScrollIndicator = false;
  83. [self.view addSubview:scrollView];
  84. NSString *str = SPSBAgreement;
  85. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 30, jxh_screenWidth() - 30, jxh_screenHeight())];
  86. label.numberOfLines = 0;
  87. NSAttributedString *att = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
  88. label.attributedText = att;
  89. [label sizeToFit];
  90. [scrollView addSubview:label];
  91. scrollView.contentSize = CGSizeMake(jxh_screenWidth(), jxh_viewHeight(label) + 30);
  92. }
  93. @end