On 20 May 2014, at 11:35, Rob Petrovec <petr...@mac.com> wrote:

> I haven’t looked at your code, but why not use a nil placeholder value when 
> binding?  Pass an options dictionary with a key / value pair of 
> NSNullPlaceholderBindingOption / <the value you want to use when nil> to the 
> -bind:… method, or specify the value for the nil placeholder in the nib.  
> Something like:
> 
> [datePicker bind: NSValueBinding
>  toObject: self
>  withKeyPath: @“myDate"
>  options: @{ NSNullPlaceholderBindingOption, [NSDate futureDate] }];
> 
> Hope that helps...
> 
> —Rob
I think the fundamental issue is that NSDatePicker always displays a date 
regardless of -dateValue or the bound value.
Using a [NSDate distantFuture] placeholder results in the NSDatePicker 
displaying 01/01/4001.

In my app some dates are optional/initially empty and hence bound to nil. I 
need the date picker to reflect this.
The TFDatePicker subclass observes a nil -dateValue or bound value and manages 
the draw state to represent this.

The subclass also provides a popover that enables the user to reset the date 
picker to nil if required.

Jonathan



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to