NSDatePicker - getting the value when it is changed

懵懂的女人 提交于 2019-12-07 03:21:01

问题


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


回答1:


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.




回答2:


The same you would any other control. Options are:

  • Target/Action
  • Binding
  • Observe notification
  • Delegate



回答3:


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



来源:https://stackoverflow.com/questions/1878814/nsdatepicker-getting-the-value-when-it-is-changed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!