Foundation: NSNumberFormatter -setNumberStyle: should always set defaults

Originator:mledford
Number:rdar://11890908 Date Originated:17-Jul-2012 12:20 PM
Status:Open Resolved:
Product:Other Product Version:
Classification:Other Bug Reproducible:Always
 
Summary:

Foundation: -setNumberStyle: should configure formatter to default settings even if previous values were set manually.


Steps to Reproduce:

NSNumberFormatter *nf = [[NSNumberFormatter alloc] init];
[nf setNumberStyle:NSNumberFormatterDecimalStyle];
[nf setMinimumFractionDigits:3];
[nf setMaximumFractionDigits:3];
// Code that uses formatter in this configuration temporarily

[nf setNumberStyle:NSNumberFormatterCurrencyStyle];


Expected Results:

I would expect the behavior to follow what the documentation states.

"Styles are essentially predetermined sets of values for certain properties. Examples of number-formatter styles are those used for decimal values, percentage values, and currency."

Thus, using -setNumberStyle: should always override any previous manually configured settings to the predetermined sets of values. In the case above it should be setting the fraction digits from the currently set locale.


Actual Results:

The previous manually -setMinimumFractionDigits: and -setMaximumFractionDigits: is held after -setNumberStyle: is set.


Regression:


Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!