登录界面键盘的回收

This commit is contained in:
fengshuo
2021-09-10 17:34:55 +08:00
parent 64c43cb737
commit 8b127baa51
5 changed files with 33 additions and 13 deletions

View File

@@ -13,10 +13,16 @@
#import "DESEncrypt.h"
///Model
#import "AccountModel.h"
///Protocol
#import "LoginPasswordProtocol.h"
@implementation LoginPasswordPresent
- (id<LoginPasswordProtocol>)getView {
return ((id<LoginPasswordProtocol>) [super getView]);
}
/// 使
/// @param phone
/// @param password
@@ -27,7 +33,7 @@
if (accountModel && accountModel.access_token.length > 0) {
[[AccountInfoStorage instance] saveAccountInfo:accountModel];
}
// [[self getView] loginSuccess];
[[self getView] phoneAndPasswordLoginSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
}] phone:phone password:desPassword client_secret:@"uyzjdhds" version:@"1" client_id:@"erban-client" grant_type:@"password"];

View File

@@ -47,6 +47,10 @@
[self initEvents];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:NO];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"忘记密码";
@@ -100,6 +104,7 @@
///
[[self.finishButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
@strongify(self);
[self.presenter resetPassword:self.phoneView.textField.text newPwd:self.passwordView.textField.text smsCode:self.codeView.textField.text];
}];
}

View File

@@ -38,10 +38,6 @@
@implementation LoginPasswordViewController
- (void)dealloc {
NSLog(@"销毁了");
}
- (LoginPasswordPresent *)createPresenter {
return [[LoginPasswordPresent alloc] init];
}
@@ -53,6 +49,10 @@
[self initEvents];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:NO];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.codeLoginButton];
@@ -110,6 +110,7 @@
}] takeUntil:self.rac_willDeallocSignal];
[[self.forgetPasswordButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
@strongify(self);
LoginForgetPasswordViewController * forgetPasswordVC = [[LoginForgetPasswordViewController alloc] init];
[self.navigationController pushViewController:forgetPasswordVC animated:YES];
}];
@@ -122,6 +123,7 @@
///
[[self.codeLoginButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
@strongify(self);
[self.navigationController popViewControllerAnimated:YES];
}];
}

View File

@@ -37,7 +37,6 @@
@end
@implementation LoginPhoneViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];

View File

@@ -37,6 +37,10 @@
@end
@implementation LoginVerifCodeViewController
- (void)dealloc
{
NSLog(@"销毁");
}
- (LoginVerifCodePresent *)createPresenter {
return [[LoginVerifCodePresent alloc] init];
@@ -50,6 +54,10 @@
[self initEvents];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:NO];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.titleStackView];
@@ -76,7 +84,7 @@
[self.retryStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.codeView.mas_bottom).offset(16);
make.centerX.mas_equalTo(self.view);
make.centerX.mas_equalTo(self.view);
make.centerX.mas_equalTo(self.view);
}];
}
@@ -90,10 +98,10 @@
@weakify(self);
self.codeView.textFieldChangeBlock = ^(NSString * _Nonnull code) {
@strongify(self);
if (self.phone.length > 0 && code.length == 5) {
[self.presenter loginWithPhone:self.phone code:code];
}
};
if (self.phone.length > 0 && code.length == 5) {
[self.presenter loginWithPhone:self.phone code:code];
}
};
}
- (NSAttributedString *)createRetrySendCodeWithTime:(int)time {
@@ -186,8 +194,8 @@
if (!_cutdownLabel) {
_cutdownLabel = [[UILabel alloc] init];
_cutdownLabel.textAlignment = NSTextAlignmentCenter;
_cutdownLabel.font = [UIFont boldSystemFontOfSize:11];
_cutdownLabel.textColor = ThemeTextColor;
_cutdownLabel.font = [UIFont boldSystemFontOfSize:11];
_cutdownLabel.textColor = ThemeTextColor;
_cutdownLabel.hidden = NO;
}
return _cutdownLabel;