Yes, simply subclass. You can then use the name of the subclass in Interface Builder (Identity Inspector > Custom class > class) in case you are creating your UI there. If you are instead creating the UI in code, just change the name of the class you are instantiating.
accessibilityScroll does get passed up the responder chain, so it would reach your view controller eventually if the specific direction is not handled on the slider (unless another view in the responder chain before, like a vertical scroll view, handles vertical scrolling in the relevant direction itself), but still, as you say, you will not get information about *which* slider got scrolled.
So back to the beginning: just subclass, and cope with the usual “hard" problem how to name the subclass :-)
Btw. I now realized you will certainly find the WWDC 2014 “Accessibility in iOS” session interesting, especially since time position 35:12.
Best regards, Boris
On Jul 5, 2015, at 12:47 AM, Alex Hall < email@hidden> wrote:
This is exactly it, thank you! I'm stuck, though: how do I implement this? I know what to do inside the function, but I'm not sure how to attach it to my slider. I see two ways: a separate view controller file for each slider, or a custom subclass of UISlider. The more I think about it, the more sense the latter option makes. Is there an easier way I'm missing, though--a way to keep all this in my single view controller? As I said, I use three sliders, so I need to know which slider was moved and act only on that one, but accessibilityIncrement/Decrement take no arguments. Is a subclass the best way to do this? On Jul 4, 2015, at 5:44 PM, Boris Dušek < email@hidden> wrote:
“one more thing” To change what three-finger swipe does, override accessibilityScroll, checking for the up/down scroll directions and handling those.
don’t forget to return true (YES) for the directions you handle (support) and false (NO) for the directions you do not handle (do not support).
--
Have a great day, Alex Hall
|