I have a UISlider with value 0, minimum value 0 and maximum value 360 (set from the utilities area), and I want the value to increment by 15 (have an interval size of 15) with each swipe through VoiceOver, and have it snap with each swipe. e.g. swiping right once -> 15, twice -> 30 etc. I've been listening to what the current value on the slider is using VoiceOver.
I've already tried something similar to:
float interval = 5.0f;//set this
[slider setValue:interval*floorf((slider.value/interval)+0.5f) animated:NO];
source: https://stackoverflow.com/a/2519573/11693942
what I did based off of this code was:
angle = Double(15 * floorf((sender.value/15) + 0.5))
sender.setValue(Float(angle), animated: true)
but this makes my slider increment by 30.
Next, I tried:
angle = Double(15 * floorf((sender.value/30) + 0.5))
sender.setValue(Float(angle), animated: true)
which does increment my slider by 15, but then the slider gets stuck at 30. I can't increase the value, but I can decrease it. At this point VoiceOver keeps saying the value is 30, too.
I didn't get any crashes or error messages. The rest of my app still works, too.