views:

265

answers:

1

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

A: 

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

submachine
That keyboard type disables the autocapitalization type somehow though. Thats my problem.
rickharrison
Oh. I didn't know that right until now."Some keyboard types do not support auto-capitalization. Specifically, this option is ignored if the value in the keyboardType property is set to UIKeyboardTypeNumberPad, UIKeyboardTypePhonePad, or UIKeyboardTypeNamePhonePad."Looks like changing it yourself is an option you need to look at. Or hopefully someone else has a better way.
submachine