开发者

Auto-capitalise keyboard upon UITextField becoming first responder

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜