How to configure NumberFormatter in Xcode


Gerriet M. Denkmann
 

macOS 12.6, Xcode Version 9.1 (9B55).

I added a NumberFormatter (Decimal) to some TextField. This now shows: “12.345”.
Not bad, but I want to see: “12.3”.

NSNumberFormatter has a property: maximumFractionDigits - but I can’t find where to use this in Xcode.

Sure, I can edit MyWindow.xib and change maximumFractionDigits=“3” to maximumFractionDigits=“1”, but somehow this feels not the right and proper way to to things.

Gerriet.


Shane Stanley
 

On 10 Nov 2017, at 9:30 pm, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

NSNumberFormatter has a property: maximumFractionDigits - but I can’t find where to use this in Xcode.
Select the formatter and in the Attributes inspector change the Behavior to OS X 10.4+ Custom.

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


Gerriet M. Denkmann
 

On 10 Nov 2017, at 18:37, Shane Stanley <sstanley@myriad-com.com.au> wrote:

On 10 Nov 2017, at 9:30 pm, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

NSNumberFormatter has a property: maximumFractionDigits - but I can’t find where to use this in Xcode.
Select the formatter and in the Attributes inspector change the Behavior to OS X 10.4+ Custom.
Indeed. The only place where I didn’t look.

Thanks a lot!

Kind regards,

Gerriet.