Trouble with NSNumberFormatter Behavior in 10.4
Trouble with NSNumberFormatter Behavior in 10.4
- Subject: Trouble with NSNumberFormatter Behavior in 10.4
- From: Berbie <email@hidden>
- Date: Fri, 2 Sep 2005 10:58:58 +0200
Hi all,
the other day I played around with the new NSNumberFormatterBehavior
in 10.4 and ran into two problems I just wanted to post:
1) setMultiplier hangs with an Division Muliplier
This Code runs perfectly if you set the Value given at mark ## to
e.g. 2.0 but hangs endlessly with this value of 0.5:
// Test NSNumberFormatter Multiplier in 10.4
NSString *testString = @"12.50";
NSNumberFormatter *testFormater = [[[NSNumberFormatter alloc]
init] autorelease];
[testFormater
setFormatterBehavior:NSNumberFormatterBehavior10_4]; // **
[testFormater setMultiplier:[NSNumber numberWithFloat:0.5]]; // ##
NSNumber *testNumber = [testFormater numberFromString:testString];
NSString *reTestString = [testFormater
stringFromNumber:testNumber];
NSLog (@"%@ > %@ > %@", testString, testNumber, reTestString);
2) Setting setDefaultFormatterBehavior:NSNumberFormatterBehavior10_4
at startup does not get noticed in NSDocument subclass
The code snippet above resides in an action message of my NSDocument
subclass. (where in the nib I already use a NSNumberFormatter created
in IB)
The problem I have is that if I set
setDefaultFormatterBehavior:NSNumberFormatterBehavior10_4 in my
AppControllers awakeFromNib and comment out the line above marked
with **, the testFormatter does _not_ behave like 10.4
But: If I set the static [NSNumberFormatter
setDefaultFormatterBehavior:NSNumberFormatterBehavior10_4] just
before this code snippet it works.
Therefore this whole stuff seems like useless for me.
Someone who gained better experiences with this? Thanks for your
feedback.
-berbie.
_______________________________________________
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