tags:

views:

179

answers:

3

I need the UITextField "ASCII Capable" keyboard to come up in numeric mode. I can't find an API for this, what am I missing?

A: 

from the documentation does this help?

The appearance of the keyboard itself can be customized using the properties provided by the UITextInputTraits protocol. Text field objects implement this protocol and support the properties it defines. You can use these properties to specify the type of keyboard (ASCII, Numbers, URL, Email, and others) to display. You can also configure the basic text entry behavior of the keyboard, such as whether it supports automatic capitalization and correction of the text.

John Stallings
Not really, I have looked at the UITextInputTraits. I have seen other apps that do this but don't know if it is via a private API.
zaph
A: 

Are you using Interface Builder? If so, click on the text field, then go to the Text Field Attributes. There will be an attribute for Keyboard. Change it to Number Pad.

Jay
I don't want the "Number Pad", I need the "ASCII Capable" keyboard in numeric mode--as if the bottom left numeric key had been pressed.
zaph
Can you give an example of how to get to it? When I try to dial and click on the button left numeric key, I get prompted to add a contact.
Jay
Open Notes App, click in a note to enter a value. Click on the lower left keyboard button which is labeled ".?123". That is what I need but I want the keyboard to come selected like that.
zaph
A: 

Assuming you have a UITextField named textField, all you need to do is call the method:

[ textField setKeyboardType:UIKeyboardTypeNumbersAndPunctuation ];

You may need to call this before the keyboard is displayed.

Jeff Kelley
zaph
With iPhone programming, it's better to pick the best of the available options than it is to chase after wild geese.
Jeff Kelley
UIKeyboardTypeNumbersAndPunctuation is the "ASCII Capable" keyboard in numeric mode, I missed this simple fact.
zaph