Re: NSDatePicker and NSNull
Re: NSDatePicker and NSNull
- Subject: Re: NSDatePicker and NSNull
- From: Daniel Eggert <email@hidden>
- Date: Sat, 23 Sep 2006 19:40:54 +0200
On Sep 23, 2006, at 12:35 AM, Tore Halset wrote:
Hello.
I have a Dictionary with different property values for an entity.
One of the values are a date, but it can be NSNull. NSDatePicker
does not handle the null-value and give the following error message:
Cannot create date from object <null> of class NSNull
What is a good way to handle this situation. Should I have a check
box for "has date". Setting it set the default date to something
and enables the date picker. Unsetting it disable the date picker.
Any other solution?
Regards,
- Tore.
Why do you use a dictionary? A more object oriented approach would be
to have a class for you entity (call it Entity if you like).
This way you can handle your NSDate picker gracefully. If you then
need an NSDictionary for some reason, just have a method in your
class, that encodes it to a dictionary.
/Daniel
_______________________________________________
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