NSNumberFormatter problem with percentage
NSNumberFormatter problem with percentage
- Subject: NSNumberFormatter problem with percentage
- From: Graham Cox <email@hidden>
- Date: Wed, 19 Nov 2008 22:37:17 +1100
I'm a bit puzzled by NSNumberFormatter when trying to use it to
display values from 0-1 as 0-100% in a text field.
In IB, I'm simply choosing the 'Percent' preset from the menu, and
using it with floats from 0 to 1, but the field ends up displaying
everything 100x too big, i.e. input is 0.5, display shows 5000%. The
multiplier is set to 100, as put there by the preset, and that implies
to me that 0.5 x 100 = 50%. So what's the magic incantation to make
this work as expected?
Secondly, and possibly related, if I set maximum and minimum limits of
0 and 1 (or should I be setting 0 and 100?) I can never exit the field
- it always fails validation.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden