Re: Bindings and empty text field nil assigments
Re: Bindings and empty text field nil assigments
- Subject: Re: Bindings and empty text field nil assigments
- From: Markus Spoettl <email@hidden>
- Date: Wed, 27 Aug 2008 23:21:17 -0700
On Aug 27, 2008, at 9:32 PM, mmalc crawford wrote:
I don't want to go and store NSNumbers instead of scalar values,
which I imagine would have the advantage of accepting nil values
inherently.
Why not? There may be an advantage if you are doing a lot of
mathematical calculations, but the disadvantage is that you have to
convert between object and scalar values for the user interface. If
you haven't already, you should profile your application to be sure
you're not prematurely optimising.
I have hundreds of thousands (if not millions) of doubles that are
stored using an NSKeyedArchiver and I suspect that using objects
instead of scalar values would increase both size of the archive and
time to load/store the numbers dramatically. I say suspect because I
didn't actually try.
Can I tell the bindings system to directly set scalars to 0 in case
of nil values?
Not directly. You could implement a value transformer to turn a nil
value into a number 0, or (best of all) you could use a formatter to
prevent a user from entering a nil in the first place...
OK, thanks that will work.
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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