123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // UserRegisterAccountViewController.m
- // XenonSDK
- //
- // Created by SAGESSE on 2019/5/29.
- // Copyright © 2019 SAGESSE. All rights reserved.
- //
- #import "XenonSDK.h"
- #import "UserRegisterAccountViewController.h"
- @interface UserRegisterAccountViewController ()
- @end
- @implementation UserRegisterAccountViewController
- - (void)registerForPassword:(id)sender {
- // Resign editing.
- [self.view endEditing:YES];
-
- // Must enter account.
- NSString* account = self.accountTextField.text;
- if (account.length == 0) {
- [XSNetwork showHudFailure:@"请输入帐号"];
- return;
- }
-
- // Must enter password.
- NSString* password = self.passwordTextField.text;
- if (password.length == 0) {
- [XSNetwork showHudFailure:@"请输入密码"];
- return;
- }
-
- [XSNetwork showHudLoading];
- [XSNetwork registerWithAccount:account password:password complete:^(id object, NSError *error) {
-
- if (error != nil) {
- [XSNetwork showHudFailure:error];
- return;
- }
-
- if (XenonSDK.sharedSDK.sdk_loginCallback) {
- XenonSDK.sharedSDK.sdk_loginCallback(object);
- }
- }];
- }
- - (void)displayModeForPassword:(UIButton*)sender {
- // Toggle password display mode.
- sender.selected = !sender.selected;
- self.passwordTextField.secureTextEntry = sender.selected;
- }
- // MARK: -
- - (BOOL)textFieldShouldReturn:(UITextField *)textField {
-
- if (textField.returnKeyType == UIReturnKeyDone) {
- [self registerForPassword:textField];
- return NO;
- }
-
- if (textField == self.accountTextField) {
- [self.passwordTextField becomeFirstResponder];
- }
-
- return YES;
- }
- @end
|