|
@@ -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;
|