nanochrome
nanochrome

Reputation: 727

NSDatePicker - getting the value when it is changed

How would I get notified of a value of a NSDatePicker, when it's changed?

Upvotes: 7

Views: 2857

Answers (3)

Mike Abdullah
Mike Abdullah

Reputation: 15003

The same you would any other control. Options are:

  • Target/Action
  • Binding
  • Observe notification
  • Delegate

Upvotes: 5

Peter Hosey
Peter Hosey

Reputation: 96333

You can bind the picker's value binding to a property of your controller, or a property of a model object (through a controller).

Upvotes: 1

bmalicoat
bmalicoat

Reputation: 2528

I've only done it on the iPhone with UIDatePicker but it is similar on the Mac, you register as a delegate and receive messages. See Apple's Docs here.

I should clarify, this tells you when it changed, you still need to call -dateValue to get the date.

Upvotes: 4

Related Questions