rickharrison
rickharrison

Reputation: 4846

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 with a standard UITextField.

Thanks

Upvotes: 3

Views: 1767

Answers (1)

ArjunShankar
ArjunShankar

Reputation: 23680

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

Upvotes: 3

Related Questions