BDR
BDR

Reputation: 143

Keyboard with Decimal Pad

My iPhone App has textfield and the selected Keyboard type is "Decimal Pad". On the simulator, there is a dot (period) on the keyboard but when running App on my phone it shows a comma. How do I ensure that the keyboard on the phone also shows a dot.

Upvotes: 1

Views: 2940

Answers (1)

rmaddy
rmaddy

Reputation: 318955

The decimal keyboard shows the decimal separator appropriate to the user's chosen locale. Run the Settings app and go to General, then International, then Region Format. This defines the locale.

You must have a different locale set in the simulator than on the iPhone.

You do not want to force a period to appear on the keyboard. You want the proper symbol to appear based on the user's locale. This way a user can enter the number in a format they are accustomed to.

This also means you should be sure to use an NSNumberFormatter to convert the entered number text into a numeric value (double, float, NSNumber, etc.).

Upvotes: 2

Related Questions