Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the new UIKeyboardTypeDecimalPad feature in iOS 4.1 SDK

Tags:

iphone

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.

like image 336
Cecile Avatar asked Sep 18 '10 17:09

Cecile


1 Answers

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;
}
like image 55
Peter DeWeese Avatar answered Nov 09 '22 22:11

Peter DeWeese