You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
4.2 KiB
103 lines
4.2 KiB
4 years ago
|
//
|
||
|
// TFEvaluationAlertView.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/17.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFEvaluationAlertView.h"
|
||
|
|
||
|
@interface TFEvaluationAlertView ()
|
||
|
|
||
|
@property (nonatomic ,strong) UIImageView *topImageView;
|
||
|
@property (nonatomic ,strong) UIButton *rejectBtn;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation TFEvaluationAlertView
|
||
|
|
||
|
- (void)createSubviews
|
||
|
{
|
||
|
[super createSubviews];
|
||
|
|
||
|
[self addSubview:self.alertBackView];
|
||
|
|
||
|
self.showDivider = NO;
|
||
|
|
||
|
self.alertTitleLabel.font = kFont30;
|
||
|
self.alertTitleLabel.text = TFLocalizedString(@"应用好评");
|
||
|
self.alertDetailContent = TFLocalizedString(@"使用还满意么?满意请点个赞呗");
|
||
|
self.cancelTitle = TFLocalizedString(@"我要吐槽");
|
||
|
|
||
|
self.cancelButton.layer.borderColor = kColorRGBA(62, 120, 232, 1).CGColor;
|
||
|
self.cancelButton.layer.borderWidth = 0.5;
|
||
|
self.cancelButton.layer.cornerRadius = self.alertViewBtnHeight / 2;
|
||
|
self.cancelButton.backgroundColor = [UIColor whiteColor];
|
||
|
[self.cancelButton setTitleColor:kColorRGBA(62, 120, 232, 1) forState:UIControlStateNormal];
|
||
|
|
||
|
self.confirmTitle = TFLocalizedString(@"五星好评");
|
||
|
self.confirmButton.layer.cornerRadius = self.alertViewBtnHeight / 2;
|
||
|
self.confirmButton.backgroundColor = kColorRGBA(62, 120, 232, 1);
|
||
|
[self.confirmButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
|
||
|
|
||
|
self.rejectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||
|
[self.rejectBtn setTitle:TFLocalizedString(@"残忍拒绝") forState:UIControlStateNormal];
|
||
|
[self.rejectBtn setTitleColor:kGrayTextLightColor forState:UIControlStateNormal];
|
||
|
[self.rejectBtn.titleLabel setFont:kMainFont];
|
||
|
[self.rejectBtn addTarget:self action:@selector(closeAlertView) forControlEvents:UIControlEventTouchUpInside];
|
||
|
[self.alertBackView addSubview:self.rejectBtn];
|
||
|
}
|
||
|
|
||
|
- (void)showAlertView
|
||
|
{
|
||
|
[super showAlertView];
|
||
|
|
||
|
self.topImageView = [[UIImageView alloc] init];
|
||
|
self.topImageView.image = [UIImage imageNamed:@"public_evaluation.png"];
|
||
|
self.topImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||
|
[self.alertBackView addSubview:self.topImageView];
|
||
|
|
||
|
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.width.mas_equalTo(self.alertBackView.mas_width).with.multipliedBy(0.8);
|
||
|
make.height.mas_equalTo(self.alertBackView.mas_width).with.multipliedBy(0.5);
|
||
|
make.centerX.mas_equalTo(self.alertBackView.mas_centerX);
|
||
|
make.bottom.mas_equalTo(self.alertBackView.mas_top).with.offset(2 * kMargin);
|
||
|
}];
|
||
|
|
||
|
[self.alertTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
|
make.top.mas_equalTo(self.alertBackView.mas_top).with.offset(3 * kMargin);
|
||
|
make.height.mas_equalTo(self.alertTitleLabel.intrinsicContentSize.height);
|
||
|
}];
|
||
|
|
||
|
[self.confirmButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.top.mas_equalTo(self.contentScrollView.mas_bottom).with.offset(kMargin);
|
||
|
make.centerX.mas_equalTo(self.alertTitleLabel.mas_centerX);
|
||
|
make.width.mas_equalTo(self.alertBackView.mas_width).multipliedBy(0.5);
|
||
|
make.height.mas_equalTo(self.alertViewBtnHeight);
|
||
|
}];
|
||
|
|
||
|
[self.cancelButton mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.centerX.mas_equalTo(self.confirmButton.mas_centerX);
|
||
|
make.top.mas_equalTo(self.confirmButton.mas_bottom).with.offset(kHalfMargin);
|
||
|
make.width.mas_equalTo(self.confirmButton.mas_width);
|
||
|
make.height.mas_equalTo(self.confirmButton.mas_height);
|
||
|
}];
|
||
|
|
||
|
[self.rejectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.centerX.mas_equalTo(self.confirmButton.mas_centerX);
|
||
|
make.top.mas_equalTo(self.cancelButton.mas_bottom).with.offset(5);
|
||
|
make.width.mas_equalTo(self.confirmButton.mas_width);
|
||
|
make.height.mas_equalTo(self.confirmButton.mas_height);
|
||
|
}];
|
||
|
|
||
|
[self.alertBackView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.width.mas_equalTo(self.alertViewWidth);
|
||
|
make.bottom.mas_equalTo(self.rejectBtn.mas_bottom).with.offset(kHalfMargin);
|
||
|
make.centerX.mas_equalTo(self.mas_centerX);
|
||
|
make.centerY.mas_equalTo(self.mas_centerY);
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
@end
|