123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- //
- // APInputAlertView.m
- // westkissMob
- //
- // Created by iOS on 2023/7/28.
- //
- #import "APInputAlertView.h"
- #import "ASWindowManager.h"
- @interface APInputAlertView() <UITextViewDelegate>
- @property (nonatomic, strong) UILabel *titleLb;
- @property (nonatomic, strong) UIButton *closeBt;
- @property (nonatomic, strong) UILabel *contentLb;
- @property (nonatomic, strong) UIView *inputBgV;
- @property (nonatomic, strong) UITextView *inputTv;
- @property (nonatomic, strong) UIButton *sureBt;
- @property (nonatomic, strong) UIButton *cancelBt;
- @property (nonatomic, strong) UILabel *tvPlaceHoldLb;
- @property (nonatomic, strong) UILabel *tipLb;
- @end
- @implementation APInputAlertView
- - (void)setTitle:(NSString *)title des:(NSString *)des {
- self.titleLb.text = title;
- self.contentLb.text = des;
- }
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- [self setUI];
- }
- return self;
- }
- - (void)setUI {
- self.backgroundColor = UIColor.whiteColor;
- self.layer.cornerRadius = 16;
- self.layer.masksToBounds = true;
- [self addSubview:self.titleLb];
- [self addSubview:self.closeBt];
- [self addSubview:self.contentLb];
- [self addSubview:self.inputBgV];
- [self addSubview:self.cancelBt];
- [self addSubview:self.sureBt];
- [self addSubview:self.tipLb];
- [self.inputBgV addSubview:self.inputTv];
- [self.inputBgV addSubview:self.tvPlaceHoldLb];
-
- [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self);
- make.top.equalTo(self).offset(16);
- }];
- [self.closeBt mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(12);
- make.trailing.equalTo(self).offset(-12);
- make.width.height.equalTo(@30);
- make.leading.equalTo(self.titleLb.mas_trailing).offset(8);
- }];
-
- [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLb.mas_bottom).offset(16);
- make.leading.equalTo(self).offset(25);
- make.trailing.equalTo(self).offset(-25);
- }];
- [self.inputBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentLb.mas_bottom).offset(16);
- make.leading.trailing.equalTo(self.contentLb);
- make.height.equalTo(self.inputBgV.mas_width).multipliedBy(3.0/5);
- }];
- [self.inputTv mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.leading.equalTo(self.inputBgV).offset(14);
- make.bottom.trailing.equalTo(self.inputBgV).offset(-14);
- }];
- [self.tvPlaceHoldLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.leading.equalTo(self.inputTv).offset(6);
- make.trailing.equalTo(self.inputTv).offset(-6);
- make.bottom.lessThanOrEqualTo(self.inputTv);
- }];
-
- [self.cancelBt mas_makeConstraints:^(MASConstraintMaker *make) {
- make.trailing.equalTo(self.inputBgV);
- make.height.equalTo(@45);
- make.top.equalTo(self.inputBgV.mas_bottom).offset(16);
-
- }];
-
- [self.sureBt mas_makeConstraints:^(MASConstraintMaker *make) {
- make.leading.equalTo(self.inputBgV);
- make.height.width.centerY.equalTo(self.cancelBt);
- make.trailing.equalTo(self.cancelBt.mas_leading).offset(-20);
- }];
-
- [self.tipLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.sureBt.mas_bottom).offset(10);
- make.leading.trailing.equalTo(self.inputBgV);
- IPhoneXHeigh;
- make.bottom.equalTo(self).offset(-securityBottom_H-30);
- }];
-
-
-
- }
- - (UILabel *)tvPlaceHoldLb {
- if (!_tvPlaceHoldLb) {
- UILabel *lb = [UILabel new];
- lb.font = [UIFont fontWithName:Rob_Regular size:14];
- lb.textColor = Col_999;
- lb.numberOfLines = 0;
- lb.text = @"Please Input The Reason For Your Leave";
- _tvPlaceHoldLb = lb;
- }
- return _tvPlaceHoldLb;
- }
- - (UIView *)inputBgV {
- if (!_inputBgV) {
- UIView *v = [UIView new];
- v.backgroundColor = _F8F8F8;
- v.layer.cornerRadius = 5;
- v.layer.borderWidth = 1;
- v.layer.borderColor = _D0D0D0.CGColor;
- v.layer.masksToBounds = true;
- _inputBgV = v;
- }
- return _inputBgV;
- }
- - (UITextView *)inputTv {
- if (!_inputTv) {
- UITextView *v = [UITextView new];
- v.backgroundColor = UIColor.clearColor;
- v.font = [UIFont fontWithName:Rob_Regular size:14];
- v.textColor = Col_333;
- v.delegate = self;
- _inputTv = v;
- }
- return _inputTv;
- }
- - (UIButton *)closeBt {
- if (!_closeBt) {
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- [btn setImage:[UIImage imageNamed:@"productLsit_filter_close"] forState:UIControlStateNormal];
- [btn addTarget:self action:@selector(closeBtAction) forControlEvents:UIControlEventTouchUpInside];
- _closeBt = btn;
- }
- return _closeBt;
- }
- - (UILabel *)contentLb {
- if (!_contentLb) {
- UILabel *lb = [[UILabel alloc] init];
- lb.font = [UIFont fontWithName:Rob_Regular size:14];
- lb.textColor = [UIColor blackColor];
- lb.numberOfLines = 0;
- lb.text = @"A New Version Of West Kiss Upgrade Version 1.1.0 Is Available For Your Phone And Is Ready To Install Now!";
- lb.textAlignment = NSTextAlignmentCenter;
- lb.backgroundColor = [UIColor clearColor];
- lb.qmui_lineHeight = 24;
- _contentLb = lb;
- }
- return _contentLb;
- }
- - (UILabel *)tipLb {
- if (!_tipLb) {
- UILabel *lb = [[UILabel alloc] init];
- lb.font = [UIFont fontWithName:Rob_Bold size:14];
- lb.textColor = [UIColor redColor];
- lb.numberOfLines = 0;
- lb.text = @"* Your account will be deleted after submit.";
- lb.textAlignment = NSTextAlignmentCenter;
- lb.backgroundColor = [UIColor clearColor];
- lb.qmui_lineHeight = 24;
- _tipLb = lb;
- }
- return _tipLb;
- }
- - (UILabel *)titleLb {
- if (!_titleLb) {
- UILabel *lb = [[UILabel alloc] init];
- lb.font = [UIFont fontWithName:Rob_Bold size:22];
- lb.qmui_lineHeight = 24;
- lb.textColor = [UIColor blackColor];
- lb.text = @"Deleted Account";
- lb.textAlignment = NSTextAlignmentCenter;
- lb.backgroundColor = [UIColor clearColor];
- _titleLb = lb;
- }
- return _titleLb;
- }
- - (UIButton *)sureBt {
- if (!_sureBt) {
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.backgroundColor = [UIColor blackColor];
- [btn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
- [btn setTitle:@"Submit" forState:UIControlStateNormal];
- btn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:16];
- btn.layer.cornerRadius = 4;
- btn.layer.masksToBounds = true;
- [btn addTarget:self action:@selector(sureBtAction) forControlEvents:UIControlEventTouchUpInside];
- _sureBt = btn;
- }
- return _sureBt;
- }
- - (UIButton *)cancelBt {
- if (!_cancelBt) {
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.backgroundColor = [UIColor whiteColor];
- [btn setTitleColor:Col_666 forState:UIControlStateNormal];
- [btn setTitle:@"Cancel" forState:UIControlStateNormal];
- btn.layer.borderWidth = 1;
- btn.layer.borderColor = _D0D0D0.CGColor;
- btn.layer.cornerRadius = 4;
- btn.layer.masksToBounds = true;
- btn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:16];
- [btn addTarget:self action:@selector(cancelBtAction) forControlEvents:UIControlEventTouchUpInside];
- _cancelBt = btn;
- }
- return _cancelBt;
- }
- - (void)sureBtAction {
- if (self.sureAction) {
- self.sureAction(self.inputTv.text);
- }
- ASWindowManager.share.activeW = nil;
- }
- - (void)cancelBtAction {
- if (self.cancelAction) {
- self.cancelAction();
- }
- ASWindowManager.share.activeW = nil;
-
- }
- - (void)closeBtAction {
- if (self.closeAction) {
- self.closeAction();
- }
- ASWindowManager.share.activeW = nil;
- }
- - (void)textViewDidChange:(UITextView *)textView {
- self.tvPlaceHoldLb.hidden = textView.text.length > 0;
- }
- @end
|