Xcode : Number pad with point for comma

房东的猫 提交于 2020-01-03 05:53:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!