// // SPSBAppCommentViewController.m // 我的社保 // // Created by shanp on 2021/4/29. // #import "SPSBAppCommentViewController.h" #import "SPSBUIGeneralHeader.h" #import "SPSBKeyProfile.h" @interface SPSBAppCommentViewController () @end @implementation SPSBAppCommentViewController - (void)viewDidLoad { [super viewDidLoad]; [self setupUI]; } #pragma mark - Action - (void)commentAction:(UIButton *)sender { if (sender.tag == 3000) { jxh_openUrl([NSURL URLWithString:SPSBUrlToAppStoreComment], nil); } [self hideAnimation:^(BOOL finished) { [self dismissViewControllerAnimated:false completion:nil]; }]; } #pragma mark - Network Action #pragma mark - UI - (void)setupUI { self.view.backgroundColor = spsb_000000_color(SPSBPopupViewBackgroundAlpha); UIView *commentBG = UIView.new; commentBG.backgroundColor = [UIColor whiteColor]; [commentBG setLayerCornerRadius:8 clipToBounds:true]; UIImageView *topView = [[UIImageView alloc] initWithImage:jxh_getImage(wuxinhaoping)]; [commentBG addSubview:topView]; [topView makeConstraints:^(JXHConstraintMaker *make) { make.top.and.leading.equalTo(0); }]; UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(21) text:[NSString stringWithFormat:@"喜欢“%@”吗?", SPSBAppName] textColor:spsb_333333_color() textAlignment:NSTextAlignmentCenter]; [commentBG addSubview:title]; [title makeConstraints:^(JXHConstraintMaker *make) { make.top.equalTo(topView.bottom).offset(28); make.centerX.equalTo(commentBG); }]; UILabel *content = [UILabel convenienceWithFont:spsb_font(17) textColor:spsb_999999_color() limitWidth:313 - 64]; [content setAttributedStringWithText:@"你的建议和鼓励会助我们做的更好,期待五星好评!" textAlignment:NSTextAlignmentCenter lineSpacing:4 lineHeight:0 paragraphSpacing:0 lineBreakMode:NSLineBreakByTruncatingTail]; [commentBG addSubview:content]; [content makeConstraints:^(JXHConstraintMaker *make) { make.top.equalTo(title.bottom).offset(10); make.leading.equalTo(32); make.trailing.equalTo(-32); }]; UIButton *button = [UIButton convenienceWithFont:spsb_semiboldFont(16) target:self action:@selector(commentAction:)]; [button setTitle:@"鼓励一下" titleColor:spsb_FFFFFF_color(1.f) image:nil backgroundImage:jxh_getImage(confirm_n) state:JXHButtonControlStateNormal]; [button setBackgroundImage:jxh_getImage(confirm_h) state:JXHButtonControlStateHighlighted]; button.tag = 3000; [button setLayerCornerRadius:22.5 clipToBounds:true]; [commentBG addSubview:button]; [button makeConstraints:^(JXHConstraintMaker *make) { make.top.equalTo(content.bottom).offset(20); make.centerX.equalTo(commentBG); make.size.equalTo(CGSizeMake(259, 45)); }]; button = [UIButton convenienceWithFont:spsb_font(17) target:self action:@selector(commentAction:)]; [button setTitle:@"等下再说" titleColor:spsb_999999_color() state:JXHButtonControlStateNormal]; button.tag = 3001; [commentBG addSubview:button]; [button makeConstraints:^(JXHConstraintMaker *make) { make.bottom.equalTo(-30); make.centerX.equalTo(commentBG); make.size.equalTo(CGSizeMake(68, 24)); }]; [self.view addSubview:commentBG]; [commentBG makeConstraints:^(JXHConstraintMaker *make) { make.size.equalTo(CGSizeMake(313, 396)); make.center.equalTo(commentBG.superview); }]; } @end