Last Updated: February 25, 2016
·
356
· brendanjcaffrey

Dealing With NSDatePickerCellDelegate in RubyMotion

Figuring out how to use the proposedDateValue in datePickerCell:validateProposedDateValue:timeInterval: took me a little bit, and I couldn't find any other notes on it, so I'm just recording what I did here. proposedDateValue is an instance of Pointer, so all you have to do is proposedDateValue[0] to get at the object it contains, which helpfully gets converted to an instance of Time.

def datePickerCell(aDatePickerCell, validateProposedDateValue:proposedDateValue, timeInterval:proposedTimeInterval)
  puts proposedDateValue[0].inspect
  puts proposedDateValue[0].class
end

The above code leads to output like this when you change the value of the date picker:

2014-09-13 05:43:10 -0500
Time