jonhull / GradientSlider

MIT License
241 stars 29 forks source link

UIEvent is nil in valueChanged callback #11

Open yonilevy opened 5 years ago

yonilevy commented 5 years ago

Hi,

Great little library, thanks for your work!

I've replaced some UISliders with your GradientSlider, and noticed that (unlike UISlider), when setting an action/target pair for UIControlEventValueChanged of the form: - (void)action:(id)sender forEvent:(UIEvent *)event the received event is always nil.

I believe this is due to the calls to sendActions losing the associated UIEvent info, and successfully implemented a fix by replacing them with loops of sendAction calls.

Also - not sure, but I believe the call to sendActions in beginTracking should include valueChanged in its controlEvents to match UISlider behavior.

Let me know if this is at all something you wish to change, I could submit a small PR (tho my swift is weak)

Thanks!