• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDatePicker : Displaying and binding to nil.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDatePicker : Displaying and binding to nil.


  • Subject: Re: NSDatePicker : Displaying and binding to nil.
  • From: Rob Petrovec <email@hidden>
  • Date: Tue, 20 May 2014 03:35:52 -0700

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


> On May 15, 2014, at 2:47 PM, Jonathan Mitchell <email@hidden> wrote:
>
> NSDatePicker cannot display or bind to a nil dateValue so I have put together something that might be of use when binding to NSDate instances that might be nil.
>
> https://github.com/ThesaurusSoftware/TFDatePicker
>
> Subclassing NSDatePickerCell is made difficult because NSDatePickerCell does not call - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView to draw its interior.
> I therefore obscure the controls persistent dateValue by setting the fore and background colours equal.
>
> If anyone can think of a better approach I would be glad to hear it.
>
> Jonathan
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> 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


_______________________________________________

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


  • Follow-Ups:
    • Re: NSDatePicker : Displaying and binding to nil.
      • From: Jonathan Mitchell <email@hidden>
References: 
 >NSDatePicker : Displaying and binding to nil. (From: Jonathan Mitchell <email@hidden>)

  • Prev by Date: Re: Quartz Display Services & Retina Display Modes
  • Next by Date: Re: NSDatePicker : Displaying and binding to nil.
  • Previous by thread: NSDatePicker : Displaying and binding to nil.
  • Next by thread: Re: NSDatePicker : Displaying and binding to nil.
  • Index(es):
    • Date
    • Thread