I'm trying to react to the event that a UIPickerView
started moving (not when the row was already selected).
I have searched throughout the delegate methods, and none helped. I also tried to register a notification, but couldn't figure out any that would notify as the user puts his finger on the component and starts scrolling.
Any ideas of what alternatives are there?
You can create a custom class of
UIPickerView
and overridehitTest(point:with:)
. Creating a protocol, you can send the current picker through a delegate method to your controller and draw whatever you like:Do NOT forget (in your controller: eg.
YourViewController
):self.pickerView.myDelegate = self
.Create an extension of your controller the subscribes to
CustomPickerViewDelegate
protocol:If you like you can extend the
UIPickerViewDelegate
(see below how you can extend base class delegate)Extending a delegate from a base class
Good luck :]