在Cocoa應用程序中,我使用了大量「帶有數字格式程序的文本字段」對象。這些對象通過在適當的地方添加逗號來改善數據的顯示,因此數字「123456」顯示爲「123,456」。這是有幫助的當數用下面的代碼爲float類型,並填充:用數字格式化程序指定文本字段中的小數位數
[OutR2C2 setFloatValue:MyVariable2 ];
那麼,數字「123456.567」是作爲「123,456.567」和數字「123456.5」是作爲「123,456.5 「。
我需要能夠指定小數點後總是有兩位數字,如123,456.50或123,456.56等所有提供的數字。在這個對象的屬性中,我沒有看到任何設置小數點的方法。
如何在使用「帶有數字格式化程序的文本字段」對象時執行此操作?