UITextField setAutocapitalizationType wonky behavior
I've got two XIB-generated UITextFields that I'm conditionally configuring in -viewWillAppear: as follows:
//Configure text fields
[emailField setDelegate:self];
[emailField setKey开发者_如何学JAVAboardType:UIKeyboardTypeEmailAddress];
[emailField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[emailField setAutocorrectionType:UITextAutocorrectionTypeNo];
[nameField setDelegate:self];
[nameField setKeyboardType:UIKeyboardTypeAlphabet];
[nameField setAutocapitalizationType:UITextAutocapitalizationTypeWords];
[nameField setAutocorrectionType:UITextAutocorrectionTypeNo];
emailField behaves normally. nameField behaves normally with one exception:
When nameField becomes the First Responder, either by calling -becomeFirstResponder or by tapping in the field, the Shift/Caps button highlights (as expected), and turns off for subsequent characters (as expected), but no characters are ever actually capitalized.
Cool, I was being an idiot.
This behavior was taking place in the simulator, and I was using my Mac's keyboard to enter the text. Of course it wasn't going to capitalize.
Clicking on the keyboard keys in the simulator produced proper results, as did running the app on-device.
Hope someone else can save a headache with this.
(:Mikey:)
精彩评论