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:23:30 -0700
On Aug 27, 2008, at 9:21 PM, Quincey Morris wrote:
I suspect you can get the effect you want by using a formatter on
the text field. Someone was complaining on this list a week or two
ago that 10.4+ style formatters never set properties to nil values,
but this sounds like the behavior you want.
There's another reason you should generally be using formatters.
Without them, the value of the text field gets sent *as a string*,
which eventually gets converted to a scalar with [NSString
integerValue] or [NSString doubleValue] (etc). Unfortunately,
there's no [NSString unsignedIntegerValue] (etc) so if your property
is type NSUInteger (etc) the conversion will throw an exception.
When you use formatters, the value of the text field gets sent as a
NSNumber, which supports all the conversions to a scalar.
I guess that's the way to go, thanks!
Regards
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