开发者

UIKeyboardTypeNamePhonePad auto capitalization

I am using a UIKeyBoardTypeNamePhonePad to allow entry of just letters and numbers. It is missing some functionality that I need. First, I need all the letters that are typed to be capitalized. I can just change it as it enters the text view, but I don't want the user to be confused on how to enter capital letters. Also, I want the number pad to show up when the keyboard first pops up. Could you guys point me in the right direction as to how to achieve this functionality? The keyboard is being used wit开发者_如何学Goh a standard UITextField.

Thanks


According to the class reference, UITextField implements the UITextInputTraits protocol. You can set the autocapitalization type using this:

[myTxtFld setAutocapitalizationType:UITextAutocapitalizationTypeAllCharacters];

You can set the keyboard type:

[myTxtFld setKeyboardType:UIKeyboardTypeNumberPad];

Have a look at this: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜