IPhone : NSNumberFormatter glitch

on Sunday, April 19, 2015

I have a strange problem. It only seems to present on a tester's iPhone 5s. It works correctly on an iPhone 5, 6 and 6 plus, all running the latest iOS (8.3).


This is the code



-(NSString *) commaString:(double)number
{
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
[numberFormatter setGroupingSize:3];
[numberFormatter setMaximumSignificantDigits:9];
NSString *numberAsString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble: number]];

return numberAsString;
}


The application is a calculator and is usually presenting correctly like this


It is usually showing correctly like this enter image description here

but on this iPhone 5s it is showing like this enter image description here


I thought the setMaximumSignificantDigits would have nipped this in the bud, but it's still showing the same. Could this be some strange localisation thing? I don't think it is as his iPhone 6 it is showing correctly also.

Thanks

Luke


0 comments:

Post a Comment