SPSBSafeProblemDetailsViewController.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // SPSBSafeProblemDetailsViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/22.
  6. //
  7. #import "SPSBSafeProblemDetailsViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. @interface SPSBSafeProblemDetailsViewController () {
  10. UIScrollView *_bgView;
  11. UIView *_questionView;
  12. }
  13. @end
  14. @implementation SPSBSafeProblemDetailsViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. [self setupUI];
  18. }
  19. #pragma mark - Action
  20. #pragma mark - Network Action
  21. #pragma mark - UI
  22. - (void)setupUI {
  23. self.title = @"常见问题";
  24. [self createBgView];
  25. [self createQuestionView];
  26. [self createAnswerView];
  27. }
  28. - (void)createBgView {
  29. _bgView = [UIScrollView convenienceWithBackgroundColor:spsb_FFFFFF_color(1.f)];
  30. [self.view addSubview:_bgView];
  31. [_bgView makeConstraints:^(JXHConstraintMaker *make) {
  32. make.edges.equalTo(self.view);
  33. }];
  34. }
  35. - (void)createQuestionView {
  36. _questionView = UIView.new;
  37. [_bgView addSubview:_questionView];
  38. [_questionView makeConstraints:^(JXHConstraintMaker *make) {
  39. make.top.and.leading.and.trailing.equalTo(0);
  40. make.width.equalTo(jxh_screenWidth());
  41. }];
  42. UILabel *question = [UILabel convenienceWithFont:spsb_semiboldFont(17) textColor:spsb_333333_color() limitWidth:jxh_screenWidth() - 56];
  43. [question setAttributedStringWithText:_spsb_question[@"question"] lineSpacing:5];
  44. [_questionView addSubview:question];
  45. [question makeConstraints:^(JXHConstraintMaker *make) {
  46. make.leading.equalTo(28);
  47. make.trailing.equalTo(-28);
  48. make.top.equalTo(20);
  49. make.bottom.equalTo(-20);
  50. }];
  51. }
  52. - (void)createAnswerView {
  53. UIView *answerView = UIView.new;
  54. [_bgView addSubview:answerView];
  55. [answerView makeConstraints:^(JXHConstraintMaker *make) {
  56. make.top.equalTo(self->_questionView.bottom);
  57. make.leading.and.trailing.equalTo(0);
  58. make.bottom.equalTo(-40);
  59. }];
  60. UILabel *answer = [UILabel convenienceWithFont:spsb_font(16) textColor:spsb_333333_color() limitWidth:jxh_screenWidth() - 56];
  61. [answer setAttributedStringWithText:_spsb_question[@"answer"] textAlignment:NSTextAlignmentLeft lineSpacing:5 lineHeight:0 paragraphSpacing:10 lineBreakMode:NSLineBreakByWordWrapping];
  62. [answerView addSubview:answer];
  63. [answer makeConstraints:^(JXHConstraintMaker *make) {
  64. make.leading.equalTo(28);
  65. make.trailing.equalTo(-28);
  66. make.top.equalTo(16);
  67. make.bottom.equalTo(0);
  68. }];
  69. }
  70. @end