Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextField autocapitalizationType UITextAutocapitalizationTypeAllCharacters not working on device

You can set the autocapitalizationType property of a UITextField so all input is in upper case. I find that does work fine on the simulator (when actually tapping the simulator's keypad, not the Mac's keyboard), but not on the device? Everything stays lowercase.

In the UICatalog demo I added to the textFieldNormal method:

textFieldNormal.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;

Added a delegate too, to display the actual autocapitalizationType for the UITextField:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    NSLog( @"textField.autocapitalizationType=%d", textField.autocapitalizationType );
}

It will properly display 3 (=UITextAutocapitalizationTypeAllCharacters), but anything you tap remains lowercase. What am I missing?

like image 703
RickJansen Avatar asked Jul 26 '13 11:07

RickJansen


1 Answers

Apparently this is a device general settings issue: Settings -> General -> Keyboard -> Auto-Capitalization must be ON to honour the setting of textField.autocapitalizationType to all upper case, else setting the property is ignored, apparently. If I switch it on everything works as expected.

like image 65
RickJansen Avatar answered Nov 10 '22 10:11

RickJansen