我在 UITextField 中的字符自动大写时遇到了一些问题。它在默认的 UIKeyboard 上运行良好,但是如果我尝试使用 UIKeyboardTypeNamePhonePad,那么自动大写不会起作用。
这是我的代码,
- (void)viewDidLoad {
//..
//get keyboard and textfield ready
codeTextField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 15.0, 300.0, 45.0)];
codeTextField.delegate = self;
UIFont *textFieldFont = [UIFont fontWithName:@"Helvetica" size:20.0];
[codeTextField setFont:textFieldFont];
codeTextField.textColor = [UIColor blackColor];
[codeTextField setKeyboardType:UIKeyboardTypeNamePhonePad];
[codeTextField setAutocapitalizationType:UITextAutocapitalizationTypeAllCharacters];
[codeTextField setAutocorrectionType:UITextAutocorrectionTypeNo];
//..