Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDatePicker valueChanged as wheels spin?

I’m using a UIDatePicker to update UILabel with a date, but I’m noticing that the valueChanged event is only called when the wheels stop spinning.

Ideally if the user flicks a column, I’d like the date in the label to update continuously as the wheel spins, for a realtime sense of feedback.

Is this possible?

like image 500
Luke Avatar asked Nov 27 '25 17:11

Luke


1 Answers

This is an extreme workaround, but...

If you use a UIPickerView instead of a UIDatePicker (which, granted, would entail re-implementing most of the DatePicker), you can detect the wheel spinning in the pickerView:viewForRow:forComponent:reusingView: delegate method. If there are more rows than can be displayed at once, this will be called every time the wheel moves.

like image 60
Anna Dickinson Avatar answered Nov 29 '25 07:11

Anna Dickinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!