问题
I have a number pad with done button. But the user can only choose numbers without comma's. So i there a way to have a number pad with donebutton (wich I have) , integreted with punctation , or at least a point for the comma ? Thanks ! ;)
回答1:
Your question implies that you're doing to be doing some formatted number. It would then seem like a safe assumption that you're going to be working with a fixed number of decimal places (as it is more common to see a formatted number with a fixed number of decimal places than without).
If this is true, then you don't need the . or , buttons at all. You could just start with the fixed number of decimal places and shift stuff over. For example, let's say you want to type the number "4,238.07".
______.__ //type 4
______._4 //type 2
______.42 //type 3
_____4.23 //type 8
____42.38 //type 0
___423.80 //type 7
_4,238.07
来源:https://stackoverflow.com/questions/5291058/xcode-number-pad-with-point-for-comma