// // SPSBConsultationTopicDetailsViewController.m // 我的社保 // // Created by shanp on 2021/5/25. // #import "SPSBConsultationTopicDetailsViewController.h" #import "SPSBUIGeneralHeader.h" #import "SPSBConsultationHotTopicModel.h" @interface SPSBConsultationTopicDetailsViewController () { UIView *_contentView; } @end @implementation SPSBConsultationTopicDetailsViewController - (void)viewDidLoad { [super viewDidLoad]; [self setupUI]; } #pragma mark - Action - (void)dismissContentView { [_contentView makeConstraints:^(JXHConstraintMaker *make) { make.top.update(0); }]; [UIView animateWithDuration:0.3 animations:^{ [self.view layoutSubviews]; self.view.backgroundColor = spsb_000000_color(0); } completion:^(BOOL finished) { [self dismissViewControllerAnimated:false completion:nil]; }]; } #pragma mark - Network Action #pragma mark - Overwrite - (void)setupAnimation { self.view.backgroundColor = spsb_000000_color(0.f); } - (void)showAnimation { [_contentView makeConstraints:^(JXHConstraintMaker *make) { make.top.update(-jxh_viewHeight(self->_contentView)); }]; [UIView animateWithDuration:0.3 animations:^{ [self.view layoutSubviews]; self.view.backgroundColor = spsb_000000_color(SPSBPopupViewBackgroundAlpha); }]; } #pragma mark - UI - (void)setupUI { _contentView = UIView.new; _contentView.backgroundColor = spsb_FFFFFF_color(1.f); [self.view addSubview:_contentView]; [_contentView makeConstraints:^(JXHConstraintMaker *make) { make.leading.and.trailing.equalTo(0); make.height.equalTo(480); make.top.equalTo(self.view.bottom); }]; UIButton *dismissButton = [UIButton convenienceWithTarget:self action:@selector(dismissContentView)]; [self.view addSubview:dismissButton]; [dismissButton makeConstraints:^(JXHConstraintMaker *make) { make.top.and.leading.and.trailing.equalTo(0); make.bottom.equalTo(self->_contentView.top); }]; //header UIView *headerView = spsb_createShotViewHeaderWithTitle(_spsb_data.spsb_topic, @selector(dismissContentView), self); [_contentView addSubview:headerView]; [headerView makeConstraints:^(JXHConstraintMaker *make) { make.top.and.leading.and.trailing.equalTo(0); }]; //answer UIScrollView *contentBg = UIScrollView.scrollView; [_contentView addSubview:contentBg]; [contentBg makeConstraints:^(JXHConstraintMaker *make) { make.leading.and.trailing.and.bottom.equalTo(0); make.top.equalTo(headerView.bottom); }]; UILabel *contentLabel = [UILabel convenienceWithFont:spsb_font(15) textColor:spsb_151515_color() limitWidth:jxh_screenWidth() - 40]; [contentLabel setAttributedStringWithText:_spsb_data.spsb_answer lineSpacing:6]; [contentBg addSubview:contentLabel]; [contentLabel makeConstraints:^(JXHConstraintMaker *make) { make.leading.equalTo(20); make.trailing.equalTo(-20); make.width.equalTo(jxh_screenWidth() - 40); make.top.equalTo(20); make.bottom.equalTo(-30); }]; } @end