views:

43

answers:

3

How do you set the popup keyboard to only show certain keys when you type into a textfield? I know there are default keyboards but none seems suitable. Is there an alternative input option? Thanks.

A: 

Apple wont allow you to do any alterations to the keyboards..

What do you want to enter? Either create a custom keyboard, use pickers if possible or code it to not accepts certain keys..

Larsaronen
I only want the user to enter numbers and the decimal point, with all other options disabled?
mlam
Okay. I did'nt know you were allowed to change the keyboard now..I usually use a picker. and have one of the segments just contain a "," the rest of the segments are 0-9..or you could do something like this:http://stackoverflow.com/questions/276382/best-way-to-enter-numeric-values-with-decimal-pointsBut since its okay to change the keyboard now try this:http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/
Larsaronen
+1  A: 

Since iOS 3.2, you can change the keyboard :

cf. Official documentation here

Discussion

The value of this property is nil. Responder objects that require a custom view to gather input from the user should redeclare this property as readwrite and use it to manage their custom input view. When the receiver subsequently becomes the first responder, the responder infrastructure presents the specified input view automatically. Similarly, when the view resigns its first responder status, the responder infrastructure automatically dismisses the specified view.

This property is typically used to replace the system-supplied keyboard that is presented for UITextField and UITextView objects.

F.Santoni
Thanks santoni, I've thought about using buttons as keys for the InputView but it seems a bit overkill for a simple task - but it does look like this is the only option for customised keys.
mlam
A: 

Okay. I did'nt know you were allowed to change the keyboard now..

I usually use a picker. and have one of the segments just contain a "," the rest of the segments are 0-9..

or you could do something like this:

http://stackoverflow.com/questions/276382/best-way-to-enter-numeric-values-with-decimal-points

But since its okay to change the keyboard now try this:

http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/

Larsaronen
Both links are great alternatives, but they don't provide the flexibility that I need. I'll definitely keep those options in mind for future projects though. thanks. :)
mlam