When a UTextField becomes first 开发者_Python百科responder is there a way to instruct the keyboard to use the auto-capitalise mode?
I thought the Settings -> General -> Keyboard -> Auto-Capitalisation setting might be controlling this behaviour but my iOS device and the simulator both have this enabled and it does not seem to have any effect.
The UITextField
conforms to the UITextInputTraits
protocol. Through that protocol, you can set the autocapitalizationType
property of the UITextField
to influence the capitalization behavior.
For example, if you want all characters to be capitalized by default, try the following when you initialize your text field (like in your viewDidLoad method):
testField.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
精彩评论