• 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
Re: NumberFormatters and sci notation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NumberFormatters and sci notation


  • Subject: Re: NumberFormatters and sci notation
  • From: Greg Titus <email@hidden>
  • Date: Wed, 18 Jan 2006 07:17:24 -0800


On Jan 18, 2006, at 7:00 AM, Graham J Lee wrote:

On 18 Jan 2006, at 14:50, Johan Kool wrote:

Did this not work?

[fmt setFormat:@"##0,00.00"];

I have not tried this myself, but it's how I would expect it should
work from the documentation.

It gives results like: 0.2000000000000123 and: 5.551115123125783e-17

when used in combination with -setNumberStyle: which doesn't appear correct at all. BTW I'm instantiating and attaching the formatter in my NSDocument subclass' -init method, as the text fields are outlets of that class.

Ah, there's your problem. When the document subclass -init is called, the nib hasn't yet been loaded, so the outlets aren't yet setup. So you are attaching the formatter to nil. Try moving the instantiation and attachment to the -awakeFromNib method.


Hope this helps,
	- Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NumberFormatters and sci notation
      • From: Graham J Lee <email@hidden>
References: 
 >NumberFormatters and sci notation (From: Graham J Lee <email@hidden>)
 >Re: NumberFormatters and sci notation (From: Johan Kool <email@hidden>)
 >Re: NumberFormatters and sci notation (From: Graham J Lee <email@hidden>)

  • Prev by Date: Lightweight view & NSTextInput
  • Next by Date: Re: NumberFormatters and sci notation
  • Previous by thread: Re: NumberFormatters and sci notation
  • Next by thread: Re: NumberFormatters and sci notation
  • Index(es):
    • Date
    • Thread