Is this dependent upon your locale or region at all? I know that switching locales changed our number formatting for dates and times in iOS when we switch our device locale/region between the US, Italy, Canada, Costa Rica, and UK.
Can you use a custom formatter? By "honoring" the thousands separator, do you mean "displays it"? What happens if you change your locale? This could be a Canadian thing. (I'm sorry) I'm sure you've checked those already, but had to mention them. Let me know. Hopefully, I can be of a little help here. Alex Zavatone On Nov 4, 2016, at 2:05 PM, Sean McBride wrote: > On Wed, 2 Nov 2016 11:10:00 -0700, Quincey Morris said: > >>> Why on Earth does a default NSNumberFormatter ignore the user's >> choice? Am I alone thinking this is buggy? >> >> Going from memory, I think I ran into this too, once. IIRC, the problem >> is that one of the necessary parameters (e.g. the separator character, >> the number of digits per group) doesn’t default to the system settings, >> so that the formatter *would* show the grouping but it thinks it can’t. > > Thanks for confirming my sanity. :) I guess it's off to Radar again... > > <rdar://29115913> Default NSNumberFormatter created in IB fails to honour > thousands (aka group) separator > <rdar://29115955> "Attributes inspector" for NSNumberFormatter should default > to larger number for "sample input" > > Quite a shame, as most developers probably just figure the default number > formatter is the right thing to use, I'd wager that most apps out there are > in fact not rendering numbers in proper localized format. :( > >> FWIW, here’s the code I use to get a formatter to show separators (not >> via IB, obviously), but this combination of non-default parameters >> works, at least: >> >>> formatter = [[NSNumberFormatter alloc] init]; >>> formatter.formatterBehavior = NSNumberFormatterBehavior10_4; >>> formatter.usesGroupingSeparator = YES; >>> formatter.locale = [NSLocale currentLocale]; >>> formatter.groupingSize = 3; >> >> (The fact that I did this in code may also reflect the fact that I gave >> up trying to do it in IB.) > > My app shows a lot of numbers, doing this in code would require creating so > many new outlets. :( ex: Searching my xibs for "usesGroupingSeparator="NO"" > gives 129 results. > >> The fact that the IB file seems to say there’s no grouping may not be >> significant. IB may have figured out that one required setting is >> missing, so disabling the grouping completely might be an effect, not a >> cause. > > In fact, a search & destroy of "usesGroupingSeparator="NO"" and > "groupingSize="0"" in the xib seems to fix the problem for me. I'll probably > go with that "solution". > > Cheers, > > -- > ____________________________________________________________ > Sean McBride, B. Eng s...@rogue-research.com > Rogue Research www.rogue-research.com > Mac Software Developer Montréal, Québec, Canada > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com > > This email sent to z...@mac.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com