• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSNumberFormatter problem with percentage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSNumberFormatter problem with percentage
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Opening Ports in Leopard
  • Next by Date: RE: Core data save error with multiple persistent stores [SOLVED]
  • Previous by thread: CIAnnotation Sample Code
  • Next by thread: Re: NSNumberFormatter problem with percentage
  • Index(es):
    • Date
    • Thread