Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone keyboard with 0-9 and decimal point? [duplicate]

I'm writing an iPhone app that has a textField for the user to enter a "dollar amount" like 12.34

None of the SDK keyboards seem to have a decimal point. (OR do they?) So I decided to just let the user type in "1234" and I would add the decimal point for him... as he types.... by using EDITING CHANGED.

But each time my code adds the decimal point... it generates ANOTHER "EDITING CHANGED" event... and causes an endless loop.

Or is there an easier way to do all of the above?

like image 489
Donna Avatar asked Jan 17 '10 04:01

Donna


2 Answers

I think it would be good to point out that as of the new SDK you can use the new UIKeyboardTypeDecimalPad.

So now you just have to:

myTextField.keyboardType=UIKeyboardTypeDecimalPad;
like image 57
Zebs Avatar answered Nov 02 '22 23:11

Zebs


Please post your request as a bug in the iPhone Developer Portal. Apple will not add a new keyboard type that is simply numbers with the decimal separator until they hear from a large number of developers who need one...

-t

like image 41
Tim Avatar answered Nov 02 '22 23:11

Tim