Pārlūkot izejas kodu

1.输入法类型限定

huangxiaodong 3 mēneši atpakaļ
vecāks
revīzija
82badfd472

+ 15 - 6
创维盒子/code/Class/Guide/LoginType1ViewController.m

@@ -117,7 +117,7 @@
     _accountTF.textColor = [UIColor blackColor];
     _accountTF.font = [UIFont systemFontOfSize:14];
     _accountTF.delegate = self;
-    _accountTF.keyboardType = UIKeyboardTypeNamePhonePad;
+    _accountTF.keyboardType = UIKeyboardTypeASCIICapable;//UIKeyboardTypeNamePhonePad;
     _accountTF.rightView = scanBut;
     _accountTF.rightViewMode = UITextFieldViewModeAlways;
     [bgView addSubview:_accountTF];
@@ -264,12 +264,21 @@
 #pragma mark - UITextFieldDelegate Methods
  
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-    // 在这里处理文本输入事件
-    //NSString *currentText = textField.text;
-    //NSString *updatedText = [currentText stringByReplacingCharactersInRange:range withString:string];
+    // 允许删除操作
+    if (string.length == 0) {
+        return YES;
+    }
+    
+    // 定义允许输入的字符集
+    NSCharacterSet *allowedCharacters = [NSCharacterSet alphanumericCharacterSet];
     
-    // 打印更新后的文本
-    //NSLog(@"Updated Text: %@", updatedText);
+    // 检查输入的字符是否在允许的字符集中
+    for (NSInteger i = 0; i < string.length; i++) {
+        unichar character = [string characterAtIndex:i];
+        if (![allowedCharacters characterIsMember:character]) {
+            return NO;
+        }
+    }
     
     [self checkLoginButCanClickFun];
     return YES;

+ 1 - 1
创维盒子/code/en.lproj/Localizable.strings

@@ -669,7 +669,7 @@
 
 //1.4.4 (1.4.5)
 "input_your_account"   = "Please enter your account";
-"login_type1_but_title"   = "Login/Register";
+"login_type1_but_title"   = "Login";
 "login_protocol_tip_1"   = "I have read and agree";
 "login_protocol_tip_2"   = "User Agreement";
 "login_protocol_tip_3"   = "and";

+ 1 - 1
创维盒子/code/zh-Hans.lproj/Localizable.strings

@@ -663,7 +663,7 @@
 
 //1.4.4 (1.4.5)
 "input_your_account"   = "请输入您的账号";
-"login_type1_but_title"   = "登录/注册";
+"login_type1_but_title"   = "登录";
 "login_protocol_tip_1"   = "我已阅读并同意";
 "login_protocol_tip_2"   = "《用户协议》";
 "login_protocol_tip_3"   = "和";

+ 1 - 1
创维盒子/code/zh-Hant.lproj/Localizable.strings

@@ -668,7 +668,7 @@
 
 //1.4.4 (1.4.5)
 "input_your_account"   = "請輸入您的帳號";
-"login_type1_but_title"   = "登入/注册";
+"login_type1_but_title"   = "登入";
 "login_protocol_tip_1"   = "我已閱讀並同意";
 "login_protocol_tip_2"   = "《用戶協議》";
 "login_protocol_tip_3"   = "和";