Cecile
Cecile

Reputation: 89

How to use the new UIKeyboardTypeDecimalPad feature in iOS 4.1 SDK

Right now I am using learning to program for the iphone and I am using a sample application that has the standard numeric keypad. I need to enter decimal points too but the numeric keypad does not have any. The SDK 4.1 supports this feature but I cannot set the keyboard type to be UIKeyboardTypeDecimalPad, at least I do not see the option in Interface Builder. Can this be done from the Interface Builder? if not then where can add this in code?

thank you.

Upvotes: 6

Views: 6633

Answers (2)

Max Strater
Max Strater

Reputation: 538

As an aside, note that the UIKeyboardTypeDecimalPad doesn't seem to work on iPad.

Weird error while using UITextFieldDelegate

Which UIKeyboardType can I use on the iPad

Upvotes: 0

Peter DeWeese
Peter DeWeese

Reputation: 18333

You need to add this in your code. Interface builder doesn't seem to use it yet. You should be able to add it in for your UITextField in the viewDidLoad method of your controller. Of course, your text field will need to be wired to an IBOutlet.

- (void)viewDidLoad
{
    [super viewDidLoad];
    myTextField.keyboardType=UIKeyboardTypeDecimalPad;
}

Upvotes: 12

Related Questions