user2514282
user2514282

Reputation:

Iphone keyboard with numbers, decimal point and minus sign

I am writing an iphone app that requires numeric input. I am using textfield to receive user input, none of the built in keyboards provision for numbers, decimal point and minus sign. Do I require a custom keyboard?

Upvotes: 4

Views: 5284

Answers (2)

rmaddy
rmaddy

Reputation: 318774

No.

What you can do is use the UIKeyboardTypeDecimalPad keyboard type to get the numbers and decimal point.

Then you create a simple view that has buttons for + and - and perhaps Next/Prev and/or a Done button. This view is then used as the text field's inputAccessoryView. This view will appear just above the keyboard. You will need to handle the button events to update the value in the text field yourself.

Upvotes: 9

Undo
Undo

Reputation: 25687

Yes.

You just said that none of the built-in keyboards have a decimal point and minus sign. Therefore, you need a custom keyboard.

UIKeyboardTypeDecimalPad will get you half way there. It has (as the name suggests) a decimal character in the keyboard. No minus sign, though.

Upvotes: 1

Related Questions