NSNumberFormatter + nil values
NSNumberFormatter + nil values
- Subject: NSNumberFormatter + nil values
- From: Markus Spoettl <email@hidden>
- Date: Fri, 14 Sep 2012 14:35:08 +0200
Hi,
I'm having some trouble with a number formatter that I can't make sense of:
I have 2 NSTextFields bound to 2 NSNumber properties in my model. Both text
fields have NSNumberFormatters attached to them. One of the text fields will
cause an alert when an attempt is made to clear the field, the other one
accepts clearing/nil without problem. This is the desired behaviour, I want it
to accept nil and just set the number in my model to nil.
The original XIB goes back to Xcode 3.2.x. The difference between the number
formatters and the text fields is that one pair is old (created with Xcode 3.2.x
on Leopard) and one pair is "fresh", created with Xcode 4.4 on Lion). However,
their setup in IB is completely identical, down to the symbols configuration.
The part that is visible in IB that is, there must be something hidden that is
different. Bindings are set up identically as well, just the key paths are
different.
Does anyone know what may be causing this? Do I really need to remove the old
number formatter and re-attach a new one? I'd like to avoid that because if
possible as I have a large number of those and the UI to set it up is painfully
unhelpful.
In Leopard it was not possible to set up a NumberFormatter to accept nil at all.
I actually subclassed it to make that work. With the 10.7 SDK is seems to accept
nil values just fine. So maybe IB has a hidden flag somewhere to remember to use
the old behavior?
Thanks for any pointers!
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden