I have a question that I am looking for the answer to. I am not really understanding NSNumberFormatter. I've stared at the documentation for a while, and can't seem to understand why I can't get setMinimum (or setMaximum) to work at all.
Here is the code I am using:
NSNumberFormatter* numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
[numberFormatter setMinimum:[NSDecimalNumber decimalNumberWithString:@"2"]];
[numberFormatter setMaximum:[NSDecimalNumber decimalNumberWithString:@"2"]];
[numberFormatter setMultiplier:[NSNumber numberWithDouble:1]];
//[numberFormatter setMaximumFractionDigits:OVER9000];
NSLog(@"%@, %@", [numberFormatter stringFromNumber:[NSNumber numberWithDouble:1.123456789]], [numberFormatter stringFromNumber:[NSNumber numberWithDouble:0.8]]);
I've been playing around with stuff like that and my pla开发者_如何转开发n was that something would happen, but it really doesn't look like anything is going on (i.e. in the console, I get 1, 1)...
Since you didn't actually ask a question here's a link about NSNumberFormatter
Next time ask a question and you can get more help.
精彩评论