SPSBConsultationTopicDetailsViewController.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // SPSBConsultationTopicDetailsViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/25.
  6. //
  7. #import "SPSBConsultationTopicDetailsViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "SPSBConsultationHotTopicModel.h"
  10. @interface SPSBConsultationTopicDetailsViewController () {
  11. UIView *_contentView;
  12. }
  13. @end
  14. @implementation SPSBConsultationTopicDetailsViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. [self setupUI];
  18. }
  19. #pragma mark - Action
  20. - (void)dismissContentView {
  21. [_contentView makeConstraints:^(JXHConstraintMaker *make) {
  22. make.top.update(0);
  23. }];
  24. [UIView animateWithDuration:0.3 animations:^{
  25. [self.view layoutSubviews];
  26. self.view.backgroundColor = spsb_000000_color(0);
  27. } completion:^(BOOL finished) {
  28. [self dismissViewControllerAnimated:false completion:nil];
  29. }];
  30. }
  31. #pragma mark - Network Action
  32. #pragma mark - Overwrite
  33. - (void)setupAnimation {
  34. self.view.backgroundColor = spsb_000000_color(0.f);
  35. }
  36. - (void)showAnimation {
  37. [_contentView makeConstraints:^(JXHConstraintMaker *make) {
  38. make.top.update(-jxh_viewHeight(self->_contentView));
  39. }];
  40. [UIView animateWithDuration:0.3 animations:^{
  41. [self.view layoutSubviews];
  42. self.view.backgroundColor = spsb_000000_color(SPSBPopupViewBackgroundAlpha);
  43. }];
  44. }
  45. #pragma mark - UI
  46. - (void)setupUI {
  47. _contentView = UIView.new;
  48. _contentView.backgroundColor = spsb_FFFFFF_color(1.f);
  49. [self.view addSubview:_contentView];
  50. [_contentView makeConstraints:^(JXHConstraintMaker *make) {
  51. make.leading.and.trailing.equalTo(0);
  52. make.height.equalTo(480);
  53. make.top.equalTo(self.view.bottom);
  54. }];
  55. UIButton *dismissButton = [UIButton convenienceWithTarget:self action:@selector(dismissContentView)];
  56. [self.view addSubview:dismissButton];
  57. [dismissButton makeConstraints:^(JXHConstraintMaker *make) {
  58. make.top.and.leading.and.trailing.equalTo(0);
  59. make.bottom.equalTo(self->_contentView.top);
  60. }];
  61. //header
  62. UIView *headerView = spsb_createShotViewHeaderWithTitle(_spsb_data.spsb_topic, @selector(dismissContentView), self);
  63. [_contentView addSubview:headerView];
  64. [headerView makeConstraints:^(JXHConstraintMaker *make) {
  65. make.top.and.leading.and.trailing.equalTo(0);
  66. }];
  67. //answer
  68. UIScrollView *contentBg = UIScrollView.scrollView;
  69. [_contentView addSubview:contentBg];
  70. [contentBg makeConstraints:^(JXHConstraintMaker *make) {
  71. make.leading.and.trailing.and.bottom.equalTo(0);
  72. make.top.equalTo(headerView.bottom);
  73. }];
  74. UILabel *contentLabel = [UILabel convenienceWithFont:spsb_font(15) textColor:spsb_151515_color() limitWidth:jxh_screenWidth() - 40];
  75. [contentLabel setAttributedStringWithText:_spsb_data.spsb_answer lineSpacing:6];
  76. [contentBg addSubview:contentLabel];
  77. [contentLabel makeConstraints:^(JXHConstraintMaker *make) {
  78. make.leading.equalTo(20);
  79. make.trailing.equalTo(-20);
  80. make.width.equalTo(jxh_screenWidth() - 40);
  81. make.top.equalTo(20);
  82. make.bottom.equalTo(-30);
  83. }];
  84. }
  85. @end